From ec9ee2757d94b18f20fc8d8c09d946212ba160ea Mon Sep 17 00:00:00 2001 From: Shatur95 Date: Sun, 18 Apr 2021 16:56:35 +0300 Subject: Fix GDScript highlighting --- queries/gdscript/highlights.scm | 132 +++++++++++++++++++++++++++++++++++----- 1 file changed, 116 insertions(+), 16 deletions(-) (limited to 'queries/gdscript') 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 -- cgit v1.2.3-70-g09d2