Simplified highlights with standard capture names
This commit is contained in:
parent
f1e5e2796f
commit
8ea8f5eaed
|
|
@ -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
|
||||
"</@" @tag.delimiter
|
||||
(method_call (identifier) @function)
|
||||
|
||||
; ====================
|
||||
; HTML ELEMENTS
|
||||
; ====================
|
||||
; Parameters
|
||||
(parameter (identifier) @variable)
|
||||
|
||||
(tag_name) @tag
|
||||
(attribute_name) @attribute
|
||||
; Properties
|
||||
(struct_field (identifier) @property)
|
||||
(field_access (identifier) @property)
|
||||
(field_pattern (identifier) @property)
|
||||
|
||||
; Constructors
|
||||
(enum_variant (identifier) @constructor)
|
||||
|
||||
; Strings
|
||||
(string_literal) @string
|
||||
(char_literal) @string
|
||||
(attribute_value) @string
|
||||
|
||||
; ====================
|
||||
; TYPES
|
||||
; ====================
|
||||
|
||||
(primitive_type) @type.builtin
|
||||
(generic_params
|
||||
(identifier) @type)
|
||||
(generic_type
|
||||
(rust_path) @type)
|
||||
|
||||
; ====================
|
||||
; PATHS AND MODULES
|
||||
; ====================
|
||||
|
||||
(use_statement
|
||||
(rust_path) @module)
|
||||
(import_statement
|
||||
(string_literal) @string.special)
|
||||
|
||||
; ====================
|
||||
; EXPRESSIONS
|
||||
; ====================
|
||||
|
||||
; Template expression @ marker
|
||||
(simple_expression
|
||||
"@" @punctuation.special)
|
||||
(complex_expression
|
||||
"@" @punctuation.special)
|
||||
(safe_expression
|
||||
"@" @punctuation.special)
|
||||
(attribute_reference
|
||||
"@" @punctuation.special)
|
||||
|
||||
(expression_path
|
||||
(identifier) @variable)
|
||||
(field_access
|
||||
(identifier) @property)
|
||||
(method_call
|
||||
(identifier) @function.method)
|
||||
|
||||
; ====================
|
||||
; LITERALS
|
||||
; ====================
|
||||
|
||||
(string_literal) @string
|
||||
(char_literal) @character
|
||||
; Numbers
|
||||
(integer_literal) @number
|
||||
(float_literal) @number
|
||||
(boolean_literal) @constant.builtin
|
||||
|
||||
(escape_sequence) @string.escape
|
||||
|
||||
; ====================
|
||||
; OPERATORS
|
||||
; ====================
|
||||
; Booleans
|
||||
(boolean_literal) @boolean
|
||||
|
||||
; Operators
|
||||
(binary_operator) @operator
|
||||
(unary_operator) @operator
|
||||
"=>" @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
|
||||
"</@" @tag
|
||||
|
||||
(wildcard_pattern) @variable.builtin
|
||||
(identifier_pattern
|
||||
(identifier) @variable)
|
||||
(struct_pattern
|
||||
(rust_path) @type)
|
||||
(field_pattern
|
||||
(identifier) @property)
|
||||
; Attributes
|
||||
(attribute_name) @attribute
|
||||
(attribute (identifier) @attribute)
|
||||
|
||||
; ====================
|
||||
; ATTRIBUTES
|
||||
; ====================
|
||||
; Module paths
|
||||
(use_statement (rust_path) @type)
|
||||
(rust_path) @variable
|
||||
|
||||
(attribute_list) @attribute
|
||||
(attribute
|
||||
(identifier) @attribute)
|
||||
; Escape
|
||||
(escape_sequence) @escape
|
||||
(escape_at) @escape
|
||||
|
||||
; ====================
|
||||
; ESCAPE
|
||||
; ====================
|
||||
|
||||
(escape_at) @string.escape
|
||||
|
||||
; ====================
|
||||
; EMBEDDED LANGUAGES
|
||||
; ====================
|
||||
|
||||
(embedded_language) @embedded
|
||||
; Embedded
|
||||
(language_name) @label
|
||||
|
||||
; ====================
|
||||
; TEXT
|
||||
; ====================
|
||||
|
||||
(text_content) @none
|
||||
|
||||
; ====================
|
||||
; FALLBACK (lowest priority - must come last)
|
||||
; ====================
|
||||
|
||||
(rust_path) @module
|
||||
; Variables (fallback)
|
||||
(identifier) @variable
|
||||
|
|
|
|||
Loading…
Reference in New Issue