198 lines
3.6 KiB
Scheme
198 lines
3.6 KiB
Scheme
; Waltzing Template Highlights
|
|
; Tree-sitter query file - order matters for precedence
|
|
|
|
; ====================
|
|
; COMMENTS (highest priority - must come first)
|
|
; ====================
|
|
|
|
(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
|
|
"else" @keyword
|
|
"if" @keyword
|
|
"let" @keyword
|
|
"in" @keyword
|
|
"as" @keyword
|
|
"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
|
|
; ====================
|
|
|
|
(function_path) @function
|
|
"<@" @tag.delimiter
|
|
"</@" @tag.delimiter
|
|
|
|
; ====================
|
|
; HTML ELEMENTS
|
|
; ====================
|
|
|
|
(tag_name) @tag
|
|
(attribute_name) @attribute
|
|
(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
|
|
(integer_literal) @number
|
|
(float_literal) @number
|
|
(boolean_literal) @constant.builtin
|
|
|
|
(escape_sequence) @string.escape
|
|
|
|
; ====================
|
|
; OPERATORS
|
|
; ====================
|
|
|
|
(binary_operator) @operator
|
|
(unary_operator) @operator
|
|
"=>" @operator
|
|
"=" @operator
|
|
".." @operator
|
|
|
|
; ====================
|
|
; PUNCTUATION
|
|
; ====================
|
|
|
|
"{" @punctuation.bracket
|
|
"}" @punctuation.bracket
|
|
"(" @punctuation.bracket
|
|
")" @punctuation.bracket
|
|
"[" @punctuation.bracket
|
|
"]" @punctuation.bracket
|
|
"," @punctuation.delimiter
|
|
":" @punctuation.delimiter
|
|
";" @punctuation.delimiter
|
|
"." @punctuation.delimiter
|
|
|
|
; ====================
|
|
; PATTERNS
|
|
; ====================
|
|
|
|
(wildcard_pattern) @variable.builtin
|
|
(identifier_pattern
|
|
(identifier) @variable)
|
|
(struct_pattern
|
|
(rust_path) @type)
|
|
(field_pattern
|
|
(identifier) @property)
|
|
|
|
; ====================
|
|
; ATTRIBUTES
|
|
; ====================
|
|
|
|
(attribute_list) @attribute
|
|
(attribute
|
|
(identifier) @attribute)
|
|
|
|
; ====================
|
|
; ESCAPE
|
|
; ====================
|
|
|
|
(escape_at) @string.escape
|
|
|
|
; ====================
|
|
; EMBEDDED LANGUAGES
|
|
; ====================
|
|
|
|
(embedded_language) @embedded
|
|
(language_name) @label
|
|
|
|
; ====================
|
|
; TEXT
|
|
; ====================
|
|
|
|
(text_content) @none
|
|
|
|
; ====================
|
|
; FALLBACK (lowest priority - must come last)
|
|
; ====================
|
|
|
|
(rust_path) @module
|
|
(identifier) @variable
|