diff --git a/queries/highlights.scm b/queries/highlights.scm index b7e11d9..c9d600c 100644 --- a/queries/highlights.scm +++ b/queries/highlights.scm @@ -1,32 +1,20 @@ ; Waltzing Template Highlights -; Tree-sitter query file - order matters for precedence - -; ==================== -; COMMENTS (highest priority - must come first) -; ==================== +; Comments (template_comment) @comment (html_comment) @comment -(comment_content) @comment -(html_comment_content) @comment -; ==================== -; KEYWORDS -; ==================== - -; Template keywords -"@use" @keyword.import -"@import" @keyword.import -"@struct" @keyword.type -"@enum" @keyword.type -"@func" @keyword.function -"@if" @keyword.conditional -"@for" @keyword.repeat -"@match" @keyword.conditional -"@break" @keyword.control -"@continue" @keyword.control - -; Control flow keywords +; Keywords - using @keyword for all +"@use" @keyword +"@import" @keyword +"@struct" @keyword +"@enum" @keyword +"@func" @keyword +"@if" @keyword +"@for" @keyword +"@match" @keyword +"@break" @keyword +"@continue" @keyword "else" @keyword "if" @keyword "let" @keyword @@ -35,110 +23,48 @@ "mut" @keyword "safe" @keyword -; ==================== -; DEFINITIONS -; ==================== - -; Struct definitions -(struct_definition - (identifier) @type.definition) -(struct_field - (identifier) @property) - -; Enum definitions -(enum_definition - (identifier) @type.definition) -(enum_variant - (identifier) @constructor) - -; Function definitions -(function_definition - (identifier) @function.definition) -(parameter - (identifier) @variable.parameter) - -; ==================== -; FUNCTION TAGS -; ==================== +; Types +(primitive_type) @type +(struct_definition (identifier) @type) +(enum_definition (identifier) @type) +(generic_params (identifier) @type) +(generic_type (rust_path) @type) +; Functions +(function_definition (identifier) @function) (function_path) @function -"<@" @tag.delimiter -"" @operator "=" @operator -".." @operator - -; ==================== -; PUNCTUATION -; ==================== +; Punctuation "{" @punctuation.bracket "}" @punctuation.bracket "(" @punctuation.bracket @@ -148,50 +74,26 @@ "," @punctuation.delimiter ":" @punctuation.delimiter ";" @punctuation.delimiter -"." @punctuation.delimiter -; ==================== -; PATTERNS -; ==================== +; Tags +(tag_name) @tag +"<@" @tag +"