Simplified highlights with standard capture names
This commit is contained in:
parent
f1e5e2796f
commit
8ea8f5eaed
|
|
@ -1,32 +1,20 @@
|
||||||
; Waltzing Template Highlights
|
; Waltzing Template Highlights
|
||||||
; Tree-sitter query file - order matters for precedence
|
|
||||||
|
|
||||||
; ====================
|
|
||||||
; COMMENTS (highest priority - must come first)
|
|
||||||
; ====================
|
|
||||||
|
|
||||||
|
; Comments
|
||||||
(template_comment) @comment
|
(template_comment) @comment
|
||||||
(html_comment) @comment
|
(html_comment) @comment
|
||||||
(comment_content) @comment
|
|
||||||
(html_comment_content) @comment
|
|
||||||
|
|
||||||
; ====================
|
; Keywords - using @keyword for all
|
||||||
; KEYWORDS
|
"@use" @keyword
|
||||||
; ====================
|
"@import" @keyword
|
||||||
|
"@struct" @keyword
|
||||||
; Template keywords
|
"@enum" @keyword
|
||||||
"@use" @keyword.import
|
"@func" @keyword
|
||||||
"@import" @keyword.import
|
"@if" @keyword
|
||||||
"@struct" @keyword.type
|
"@for" @keyword
|
||||||
"@enum" @keyword.type
|
"@match" @keyword
|
||||||
"@func" @keyword.function
|
"@break" @keyword
|
||||||
"@if" @keyword.conditional
|
"@continue" @keyword
|
||||||
"@for" @keyword.repeat
|
|
||||||
"@match" @keyword.conditional
|
|
||||||
"@break" @keyword.control
|
|
||||||
"@continue" @keyword.control
|
|
||||||
|
|
||||||
; Control flow keywords
|
|
||||||
"else" @keyword
|
"else" @keyword
|
||||||
"if" @keyword
|
"if" @keyword
|
||||||
"let" @keyword
|
"let" @keyword
|
||||||
|
|
@ -35,110 +23,48 @@
|
||||||
"mut" @keyword
|
"mut" @keyword
|
||||||
"safe" @keyword
|
"safe" @keyword
|
||||||
|
|
||||||
; ====================
|
; Types
|
||||||
; DEFINITIONS
|
(primitive_type) @type
|
||||||
; ====================
|
(struct_definition (identifier) @type)
|
||||||
|
(enum_definition (identifier) @type)
|
||||||
; Struct definitions
|
(generic_params (identifier) @type)
|
||||||
(struct_definition
|
(generic_type (rust_path) @type)
|
||||||
(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
|
|
||||||
; ====================
|
|
||||||
|
|
||||||
|
; Functions
|
||||||
|
(function_definition (identifier) @function)
|
||||||
(function_path) @function
|
(function_path) @function
|
||||||
"<@" @tag.delimiter
|
(method_call (identifier) @function)
|
||||||
"</@" @tag.delimiter
|
|
||||||
|
|
||||||
; ====================
|
; Parameters
|
||||||
; HTML ELEMENTS
|
(parameter (identifier) @variable)
|
||||||
; ====================
|
|
||||||
|
|
||||||
(tag_name) @tag
|
; Properties
|
||||||
(attribute_name) @attribute
|
(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
|
(attribute_value) @string
|
||||||
|
|
||||||
; ====================
|
; Numbers
|
||||||
; 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
|
(integer_literal) @number
|
||||||
(float_literal) @number
|
(float_literal) @number
|
||||||
(boolean_literal) @constant.builtin
|
|
||||||
|
|
||||||
(escape_sequence) @string.escape
|
; Booleans
|
||||||
|
(boolean_literal) @boolean
|
||||||
; ====================
|
|
||||||
; OPERATORS
|
|
||||||
; ====================
|
|
||||||
|
|
||||||
|
; Operators
|
||||||
(binary_operator) @operator
|
(binary_operator) @operator
|
||||||
(unary_operator) @operator
|
(unary_operator) @operator
|
||||||
"=>" @operator
|
"=>" @operator
|
||||||
"=" @operator
|
"=" @operator
|
||||||
".." @operator
|
|
||||||
|
|
||||||
; ====================
|
|
||||||
; PUNCTUATION
|
|
||||||
; ====================
|
|
||||||
|
|
||||||
|
; Punctuation
|
||||||
"{" @punctuation.bracket
|
"{" @punctuation.bracket
|
||||||
"}" @punctuation.bracket
|
"}" @punctuation.bracket
|
||||||
"(" @punctuation.bracket
|
"(" @punctuation.bracket
|
||||||
|
|
@ -148,50 +74,26 @@
|
||||||
"," @punctuation.delimiter
|
"," @punctuation.delimiter
|
||||||
":" @punctuation.delimiter
|
":" @punctuation.delimiter
|
||||||
";" @punctuation.delimiter
|
";" @punctuation.delimiter
|
||||||
"." @punctuation.delimiter
|
|
||||||
|
|
||||||
; ====================
|
; Tags
|
||||||
; PATTERNS
|
(tag_name) @tag
|
||||||
; ====================
|
"<@" @tag
|
||||||
|
"</@" @tag
|
||||||
|
|
||||||
(wildcard_pattern) @variable.builtin
|
; Attributes
|
||||||
(identifier_pattern
|
(attribute_name) @attribute
|
||||||
(identifier) @variable)
|
(attribute (identifier) @attribute)
|
||||||
(struct_pattern
|
|
||||||
(rust_path) @type)
|
|
||||||
(field_pattern
|
|
||||||
(identifier) @property)
|
|
||||||
|
|
||||||
; ====================
|
; Module paths
|
||||||
; ATTRIBUTES
|
(use_statement (rust_path) @type)
|
||||||
; ====================
|
(rust_path) @variable
|
||||||
|
|
||||||
(attribute_list) @attribute
|
; Escape
|
||||||
(attribute
|
(escape_sequence) @escape
|
||||||
(identifier) @attribute)
|
(escape_at) @escape
|
||||||
|
|
||||||
; ====================
|
; Embedded
|
||||||
; ESCAPE
|
|
||||||
; ====================
|
|
||||||
|
|
||||||
(escape_at) @string.escape
|
|
||||||
|
|
||||||
; ====================
|
|
||||||
; EMBEDDED LANGUAGES
|
|
||||||
; ====================
|
|
||||||
|
|
||||||
(embedded_language) @embedded
|
|
||||||
(language_name) @label
|
(language_name) @label
|
||||||
|
|
||||||
; ====================
|
; Variables (fallback)
|
||||||
; TEXT
|
|
||||||
; ====================
|
|
||||||
|
|
||||||
(text_content) @none
|
|
||||||
|
|
||||||
; ====================
|
|
||||||
; FALLBACK (lowest priority - must come last)
|
|
||||||
; ====================
|
|
||||||
|
|
||||||
(rust_path) @module
|
|
||||||
(identifier) @variable
|
(identifier) @variable
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue