Comprehensive highlights.scm with all token types
This commit is contained in:
parent
56f54d9bcb
commit
177b9c811c
|
|
@ -1,6 +1,11 @@
|
||||||
; Waltzing Template Highlights
|
; Waltzing Template Highlights
|
||||||
|
; Comprehensive query file for tree-sitter-waltzing
|
||||||
|
|
||||||
; Keywords
|
; ====================
|
||||||
|
; KEYWORDS
|
||||||
|
; ====================
|
||||||
|
|
||||||
|
; Template keywords (with @ prefix)
|
||||||
"@use" @keyword.import
|
"@use" @keyword.import
|
||||||
"@import" @keyword.import
|
"@import" @keyword.import
|
||||||
"@struct" @keyword.type
|
"@struct" @keyword.type
|
||||||
|
|
@ -11,7 +16,8 @@
|
||||||
"@match" @keyword.conditional
|
"@match" @keyword.conditional
|
||||||
"@break" @keyword.control
|
"@break" @keyword.control
|
||||||
"@continue" @keyword.control
|
"@continue" @keyword.control
|
||||||
"@safe" @keyword.function
|
|
||||||
|
; Control flow keywords
|
||||||
"else" @keyword.conditional
|
"else" @keyword.conditional
|
||||||
"if" @keyword.conditional
|
"if" @keyword.conditional
|
||||||
"let" @keyword
|
"let" @keyword
|
||||||
|
|
@ -19,102 +25,225 @@
|
||||||
"as" @keyword
|
"as" @keyword
|
||||||
"mut" @keyword
|
"mut" @keyword
|
||||||
|
|
||||||
; Operators
|
; Safe output keyword
|
||||||
|
"safe" @keyword.function
|
||||||
|
|
||||||
|
; ====================
|
||||||
|
; OPERATORS
|
||||||
|
; ====================
|
||||||
|
|
||||||
(binary_operator) @operator
|
(binary_operator) @operator
|
||||||
(unary_operator) @operator
|
(unary_operator) @operator
|
||||||
|
|
||||||
|
; Specific operators
|
||||||
"=>" @operator
|
"=>" @operator
|
||||||
"=" @operator
|
"=" @operator
|
||||||
"::" @punctuation.delimiter
|
"!" @operator
|
||||||
|
"!=" @operator
|
||||||
|
"==" @operator
|
||||||
|
"<" @operator
|
||||||
|
"<=" @operator
|
||||||
|
">" @operator
|
||||||
|
">=" @operator
|
||||||
|
"<<" @operator
|
||||||
|
">>" @operator
|
||||||
|
"+" @operator
|
||||||
|
"-" @operator
|
||||||
|
"*" @operator
|
||||||
|
"/" @operator
|
||||||
|
"%" @operator
|
||||||
|
"&" @operator
|
||||||
|
"&&" @operator
|
||||||
|
"|" @operator
|
||||||
|
"||" @operator
|
||||||
|
"^" @operator
|
||||||
|
".." @operator
|
||||||
|
|
||||||
; Punctuation
|
; ====================
|
||||||
|
; PUNCTUATION
|
||||||
|
; ====================
|
||||||
|
|
||||||
|
; Brackets
|
||||||
"{" @punctuation.bracket
|
"{" @punctuation.bracket
|
||||||
"}" @punctuation.bracket
|
"}" @punctuation.bracket
|
||||||
"(" @punctuation.bracket
|
"(" @punctuation.bracket
|
||||||
")" @punctuation.bracket
|
")" @punctuation.bracket
|
||||||
"[" @punctuation.bracket
|
"[" @punctuation.bracket
|
||||||
"]" @punctuation.bracket
|
"]" @punctuation.bracket
|
||||||
"<" @punctuation.bracket
|
|
||||||
">" @punctuation.bracket
|
; Delimiters
|
||||||
"," @punctuation.delimiter
|
"," @punctuation.delimiter
|
||||||
":" @punctuation.delimiter
|
":" @punctuation.delimiter
|
||||||
";" @punctuation.delimiter
|
";" @punctuation.delimiter
|
||||||
|
"." @punctuation.delimiter
|
||||||
|
|
||||||
|
; Template expression marker
|
||||||
|
"@" @punctuation.special
|
||||||
|
|
||||||
|
; ====================
|
||||||
|
; LITERALS
|
||||||
|
; ====================
|
||||||
|
|
||||||
; Literals
|
|
||||||
(string_literal) @string
|
(string_literal) @string
|
||||||
(char_literal) @character
|
(char_literal) @character
|
||||||
(number_literal) @number
|
|
||||||
(integer_literal) @number
|
(integer_literal) @number
|
||||||
(float_literal) @number
|
(float_literal) @number
|
||||||
(boolean_literal) @boolean
|
(boolean_literal) @constant.builtin
|
||||||
(escape_sequence) @string.escape
|
(escape_sequence) @string.escape
|
||||||
|
"true" @constant.builtin
|
||||||
|
"false" @constant.builtin
|
||||||
|
|
||||||
; Types
|
; ====================
|
||||||
|
; TYPES
|
||||||
|
; ====================
|
||||||
|
|
||||||
|
; Primitive types
|
||||||
(primitive_type) @type.builtin
|
(primitive_type) @type.builtin
|
||||||
(rust_type) @type
|
"String" @type.builtin
|
||||||
|
"bool" @type.builtin
|
||||||
|
"char" @type.builtin
|
||||||
|
"str" @type.builtin
|
||||||
|
"i8" @type.builtin
|
||||||
|
"i16" @type.builtin
|
||||||
|
"i32" @type.builtin
|
||||||
|
"i64" @type.builtin
|
||||||
|
"i128" @type.builtin
|
||||||
|
"u8" @type.builtin
|
||||||
|
"u16" @type.builtin
|
||||||
|
"u32" @type.builtin
|
||||||
|
"u64" @type.builtin
|
||||||
|
"u128" @type.builtin
|
||||||
|
"isize" @type.builtin
|
||||||
|
"usize" @type.builtin
|
||||||
|
"f32" @type.builtin
|
||||||
|
"f64" @type.builtin
|
||||||
|
|
||||||
|
; Generic type parameters
|
||||||
(generic_params (identifier) @type)
|
(generic_params (identifier) @type)
|
||||||
(generic_type (rust_path) @type)
|
(generic_type (rust_path) @type)
|
||||||
|
|
||||||
; Struct/Enum definitions
|
; ====================
|
||||||
|
; DEFINITIONS
|
||||||
|
; ====================
|
||||||
|
|
||||||
|
; Struct definitions
|
||||||
(struct_definition (identifier) @type.definition)
|
(struct_definition (identifier) @type.definition)
|
||||||
|
(struct_field (identifier) @property.definition)
|
||||||
|
|
||||||
|
; Enum definitions
|
||||||
(enum_definition (identifier) @type.definition)
|
(enum_definition (identifier) @type.definition)
|
||||||
(struct_field (identifier) @property)
|
|
||||||
(enum_variant (identifier) @constructor)
|
(enum_variant (identifier) @constructor)
|
||||||
|
|
||||||
; Functions
|
; Function definitions
|
||||||
(function_definition (identifier) @function.definition)
|
(function_definition (identifier) @function.definition)
|
||||||
(parameter (identifier) @variable.parameter)
|
(parameter (identifier) @variable.parameter)
|
||||||
|
|
||||||
; Function tags (component calls)
|
; ====================
|
||||||
|
; FUNCTION TAGS (Components)
|
||||||
|
; ====================
|
||||||
|
|
||||||
(function_path) @function
|
(function_path) @function
|
||||||
(self_closing_function_tag) @tag
|
(self_closing_function_tag) @tag
|
||||||
(container_function_tag) @tag
|
(container_function_tag) @tag
|
||||||
|
|
||||||
|
; Function tag delimiters
|
||||||
"<@" @tag.delimiter
|
"<@" @tag.delimiter
|
||||||
"</@" @tag.delimiter
|
"</@" @tag.delimiter
|
||||||
|
"/>" @tag.delimiter
|
||||||
|
|
||||||
|
; ====================
|
||||||
|
; HTML ELEMENTS
|
||||||
|
; ====================
|
||||||
|
|
||||||
; HTML elements
|
|
||||||
(tag_name) @tag
|
(tag_name) @tag
|
||||||
(html_element) @tag
|
|
||||||
(attribute_name) @attribute
|
(attribute_name) @attribute
|
||||||
(attribute_value) @string
|
(attribute_value) @string
|
||||||
|
|
||||||
; Paths and identifiers
|
; HTML tag delimiters
|
||||||
|
"<" @tag.delimiter
|
||||||
|
">" @tag.delimiter
|
||||||
|
"</" @tag.delimiter
|
||||||
|
|
||||||
|
; ====================
|
||||||
|
; PATHS AND IDENTIFIERS
|
||||||
|
; ====================
|
||||||
|
|
||||||
|
; Module paths
|
||||||
(rust_path) @module
|
(rust_path) @module
|
||||||
(use_statement (rust_path) @module)
|
(use_statement (rust_path) @module)
|
||||||
(import_statement (string_literal) @string.special)
|
(import_statement (string_literal) @string.special)
|
||||||
|
|
||||||
; Expressions
|
; Expressions
|
||||||
(simple_expression "@" @punctuation.special)
|
|
||||||
(complex_expression "@" @punctuation.special)
|
|
||||||
(expression_path (identifier) @variable)
|
(expression_path (identifier) @variable)
|
||||||
|
(simple_expression (expression_path) @variable)
|
||||||
(field_access (identifier) @property)
|
(field_access (identifier) @property)
|
||||||
(method_call (identifier) @function.method)
|
(method_call (identifier) @function.method)
|
||||||
|
|
||||||
; Patterns
|
; ====================
|
||||||
|
; PATTERNS
|
||||||
|
; ====================
|
||||||
|
|
||||||
(wildcard_pattern) @variable.builtin
|
(wildcard_pattern) @variable.builtin
|
||||||
(identifier_pattern (identifier) @variable)
|
(identifier_pattern (identifier) @variable)
|
||||||
(struct_pattern (rust_path) @type)
|
(struct_pattern (rust_path) @type)
|
||||||
(field_pattern (identifier) @property)
|
(field_pattern (identifier) @property)
|
||||||
|
|
||||||
; Control flow
|
; ====================
|
||||||
(if_statement) @conditional
|
; COMMENTS
|
||||||
(for_loop) @repeat
|
; ====================
|
||||||
(match_statement) @conditional
|
|
||||||
(match_arm) @conditional
|
|
||||||
|
|
||||||
; Comments
|
|
||||||
(template_comment) @comment
|
(template_comment) @comment
|
||||||
(html_comment) @comment
|
(html_comment) @comment
|
||||||
|
(comment) @comment
|
||||||
|
|
||||||
|
; Comment delimiters
|
||||||
|
"@*" @comment
|
||||||
|
"*@" @comment
|
||||||
|
"<!--" @comment
|
||||||
|
"-->" @comment
|
||||||
|
|
||||||
|
; ====================
|
||||||
|
; ATTRIBUTES (derive, etc.)
|
||||||
|
; ====================
|
||||||
|
|
||||||
; Attributes (derive, etc.)
|
|
||||||
(attribute_list) @attribute
|
(attribute_list) @attribute
|
||||||
(attribute (identifier) @attribute)
|
(attribute (identifier) @attribute)
|
||||||
|
|
||||||
; Escape sequence
|
; ====================
|
||||||
|
; ESCAPE SEQUENCES
|
||||||
|
; ====================
|
||||||
|
|
||||||
(escape_at) @string.escape
|
(escape_at) @string.escape
|
||||||
|
|
||||||
; Embedded languages
|
; ====================
|
||||||
|
; EMBEDDED LANGUAGES
|
||||||
|
; ====================
|
||||||
|
|
||||||
(embedded_language) @embedded
|
(embedded_language) @embedded
|
||||||
(language_name) @label
|
(language_name) @label
|
||||||
|
|
||||||
; Text content
|
; Language name keywords
|
||||||
|
"css" @label
|
||||||
|
"style" @label
|
||||||
|
"javascript" @label
|
||||||
|
"js" @label
|
||||||
|
"json" @label
|
||||||
|
"alpine" @label
|
||||||
|
"html" @label
|
||||||
|
|
||||||
|
; Embedded block delimiters
|
||||||
|
"@```" @punctuation.special
|
||||||
|
"```@" @punctuation.special
|
||||||
|
|
||||||
|
; ====================
|
||||||
|
; TEXT CONTENT
|
||||||
|
; ====================
|
||||||
|
|
||||||
(text_content) @text
|
(text_content) @text
|
||||||
|
|
||||||
|
; ====================
|
||||||
|
; FALLBACK
|
||||||
|
; ====================
|
||||||
|
|
||||||
|
; Catch-all for identifiers not matched above
|
||||||
|
(identifier) @variable
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue