diff options
| author | Shatur95 <genaloner@gmail.com> | 2021-04-18 16:56:35 +0300 |
|---|---|---|
| committer | Thomas Vigouroux <tomvig38@gmail.com> | 2021-04-18 20:40:58 +0200 |
| commit | ec9ee2757d94b18f20fc8d8c09d946212ba160ea (patch) | |
| tree | 0757a4f046171038556849edbf2dbb7814572be1 /queries/gdscript | |
| parent | highlights(java): add new keyword "yield" (diff) | |
| download | nvim-treesitter-ec9ee2757d94b18f20fc8d8c09d946212ba160ea.tar nvim-treesitter-ec9ee2757d94b18f20fc8d8c09d946212ba160ea.tar.gz nvim-treesitter-ec9ee2757d94b18f20fc8d8c09d946212ba160ea.tar.bz2 nvim-treesitter-ec9ee2757d94b18f20fc8d8c09d946212ba160ea.tar.lz nvim-treesitter-ec9ee2757d94b18f20fc8d8c09d946212ba160ea.tar.xz nvim-treesitter-ec9ee2757d94b18f20fc8d8c09d946212ba160ea.tar.zst nvim-treesitter-ec9ee2757d94b18f20fc8d8c09d946212ba160ea.zip | |
Fix GDScript highlighting
Diffstat (limited to 'queries/gdscript')
| -rw-r--r-- | queries/gdscript/highlights.scm | 132 |
1 files changed, 116 insertions, 16 deletions
diff --git a/queries/gdscript/highlights.scm b/queries/gdscript/highlights.scm index 06b7c8df6..57009aea3 100644 --- a/queries/gdscript/highlights.scm +++ b/queries/gdscript/highlights.scm @@ -1,27 +1,127 @@ +;; Basic (identifier) @variable - (name) @variable (type) @type (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 + +(class_name_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])@!.*$")) -(enum_definition - (name) @constant) @Statement +;; Functions +(constructor_definition) @constructor (function_definition - (name) @function - (parameters - (identifier)* @parameter) @punctuation.bracket) @Statement + (name) @function (parameters + (identifier) @parameter)*) -(return_statement) @Statement +(typed_parameter + (identifier) @parameter) -(variable_statement - (inferred_type)? @operator) @Statement +(default_parameter + (identifier) @parameter) -(call (identifier) @function) @punctuation.bracket -(attribute (attribute_call (identifier) @function) @punctuation.bracket) +(call + (identifier) @function) +(attribute_call + (identifier) @function) -; simple items -[ (binary_operator) (comparison_operator) ] @operator -[ (false) (true) ] @boolean -(string) @string -(integer) @number +;; Alternations +["(" ")" "[" "]" "{" "}"] @punctuation.bracket + +["," "." ":"] @punctuation.delimiter + +["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 |
