mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 11:20:07 -04:00
Fix GDScript highlighting
This commit is contained in:
parent
1d5f928279
commit
ec9ee2757d
2 changed files with 117 additions and 17 deletions
|
|
@ -464,7 +464,7 @@ list.gdscript = {
|
||||||
requires_generate_from_grammar = true,
|
requires_generate_from_grammar = true,
|
||||||
},
|
},
|
||||||
readme_name = "Godot (gdscript)",
|
readme_name = "Godot (gdscript)",
|
||||||
maintainers = {"not @tjdevries"},
|
maintainers = {"@Shatur95"},
|
||||||
}
|
}
|
||||||
|
|
||||||
list.turtle = {
|
list.turtle = {
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,127 @@
|
||||||
|
;; Basic
|
||||||
(identifier) @variable
|
(identifier) @variable
|
||||||
|
|
||||||
(name) @variable
|
(name) @variable
|
||||||
(type) @type
|
(type) @type
|
||||||
(comment) @comment
|
(comment) @comment
|
||||||
|
(get_node) @string
|
||||||
|
(string) @string
|
||||||
|
(float) @float
|
||||||
|
(integer) @number
|
||||||
|
(null) @constant
|
||||||
|
(setter) @function
|
||||||
|
(getter) @function
|
||||||
|
(static_keyword) @keyword
|
||||||
|
(tool_statement) @keyword
|
||||||
|
(breakpoint_statement) @keyword
|
||||||
|
(inferred_type) @operator
|
||||||
|
[(true) (false)] @boolean
|
||||||
|
|
||||||
(enum_definition
|
(class_name_statement
|
||||||
(name) @constant) @Statement
|
(name) @type) @keyword
|
||||||
|
|
||||||
|
(const_statement
|
||||||
|
(name) @constant) @keyword
|
||||||
|
|
||||||
|
((identifier) @variable.builtin
|
||||||
|
(#eq? @variable.builtin "self"))
|
||||||
|
|
||||||
|
;; Identifier naming conventions
|
||||||
|
((identifier) @type
|
||||||
|
(#match? @type "^[A-Z]"))
|
||||||
|
((identifier) @constant
|
||||||
|
(#match? @constant "^[A-Z][A-Z_0-9]*$"))
|
||||||
|
((identifier) @type . ".")
|
||||||
|
|
||||||
|
((attribute
|
||||||
|
(identifier) @field)
|
||||||
|
(#vim-match? @field "^([A-Z])@!.*$"))
|
||||||
|
|
||||||
|
;; Functions
|
||||||
|
(constructor_definition) @constructor
|
||||||
|
|
||||||
(function_definition
|
(function_definition
|
||||||
(name) @function
|
(name) @function (parameters
|
||||||
(parameters
|
(identifier) @parameter)*)
|
||||||
(identifier)* @parameter) @punctuation.bracket) @Statement
|
|
||||||
|
|
||||||
(return_statement) @Statement
|
(typed_parameter
|
||||||
|
(identifier) @parameter)
|
||||||
|
|
||||||
(variable_statement
|
(default_parameter
|
||||||
(inferred_type)? @operator) @Statement
|
(identifier) @parameter)
|
||||||
|
|
||||||
(call (identifier) @function) @punctuation.bracket
|
(call
|
||||||
(attribute (attribute_call (identifier) @function) @punctuation.bracket)
|
(identifier) @function)
|
||||||
|
(attribute_call
|
||||||
|
(identifier) @function)
|
||||||
|
|
||||||
; simple items
|
;; Alternations
|
||||||
[ (binary_operator) (comparison_operator) ] @operator
|
["(" ")" "[" "]" "{" "}"] @punctuation.bracket
|
||||||
[ (false) (true) ] @boolean
|
|
||||||
(string) @string
|
["," "." ":"] @punctuation.delimiter
|
||||||
(integer) @number
|
|
||||||
|
["if" "elif" "else" "match"] @conditional
|
||||||
|
|
||||||
|
["for" "while" "break" "continue"] @repeat
|
||||||
|
|
||||||
|
[
|
||||||
|
"~"
|
||||||
|
"-"
|
||||||
|
"*"
|
||||||
|
"/"
|
||||||
|
"%"
|
||||||
|
"+"
|
||||||
|
"-"
|
||||||
|
"<<"
|
||||||
|
">>"
|
||||||
|
"&"
|
||||||
|
"^"
|
||||||
|
"|"
|
||||||
|
"<"
|
||||||
|
">"
|
||||||
|
"=="
|
||||||
|
"!="
|
||||||
|
">="
|
||||||
|
"<="
|
||||||
|
"!"
|
||||||
|
"&&"
|
||||||
|
"||"
|
||||||
|
"="
|
||||||
|
"+="
|
||||||
|
"-="
|
||||||
|
"*="
|
||||||
|
"/="
|
||||||
|
"%="
|
||||||
|
"&="
|
||||||
|
"|="
|
||||||
|
"->"
|
||||||
|
] @operator
|
||||||
|
|
||||||
|
[
|
||||||
|
"and"
|
||||||
|
"as"
|
||||||
|
"in"
|
||||||
|
"is"
|
||||||
|
"not"
|
||||||
|
"or"
|
||||||
|
] @keyword.operator
|
||||||
|
|
||||||
|
[
|
||||||
|
"pass"
|
||||||
|
"return"
|
||||||
|
"class"
|
||||||
|
"class_name"
|
||||||
|
"extends"
|
||||||
|
"signal"
|
||||||
|
"func"
|
||||||
|
"enum"
|
||||||
|
"var"
|
||||||
|
"onready"
|
||||||
|
"export"
|
||||||
|
"setget"
|
||||||
|
"remote"
|
||||||
|
"master"
|
||||||
|
"puppet"
|
||||||
|
"remotesync"
|
||||||
|
"mastersync"
|
||||||
|
"puppetsync"
|
||||||
|
] @keyword
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue