diff --git a/languages.toml b/languages.toml index 8972a6e94389..636e8a06c626 100644 --- a/languages.toml +++ b/languages.toml @@ -1795,7 +1795,7 @@ language-server = { command = "slint-lsp", args = [] } [[grammar]] name = "slint" -source = { git = "https://github.com/jrmoulton/tree-sitter-slint", rev = "0d4dda94f96623302dfc234e06be62a5717f47da" } +source = { git = "https://github.com/jrmoulton/tree-sitter-slint", rev = "07547525cdf4627343dca5891f1743ae45e879bb" } [[language]] name = "task" diff --git a/runtime/queries/slint/highlights.scm b/runtime/queries/slint/highlights.scm index c7773913d4ba..8617ebd6b641 100644 --- a/runtime/queries/slint/highlights.scm +++ b/runtime/queries/slint/highlights.scm @@ -1,77 +1,106 @@ +(identifier) @variable +(type_identifier) @type +(comment) @comment +(int_literal) @number +(float_literal) @float +(string_literal) @string +(function_identifier) @function +[ +(image_macro) +(children_macro) +(radial_grad_macro) +(linear_grad_macro) +] @function.macro +(call_expression + function: (identifier) @function.call) +(call_expression + function: (field_expression + field: (identifier) @function.call)) +(vis) @include +(units) @type +(array_literal + (identifier) @type) +(transition_statement state: (identifier) @field) +(state_expression state: (identifier) @field) +(struct_block_definition + (identifier) @field) + +; (state_identifier) @field -(user_type_identifier) @type - -(var_identifier) @variable +[ +"in" +"for" +] @repeat -(state_identifier) @variable.other.member +"@" @keyword -(var_identifier - (post_identifier) @variable) +[ +"import" +"from" +] @include -(function_identifier) @function +[ +"if" +"else" +] @conditional -(reference_identifier) @keyword.storage.modifier.ref -(visibility_modifier) @keyword.storage.modifier +[ +"root" +"parent" +"duration" +"easing" +] @variable.builtin -(comment) @comment +[ +"true" +"false" +] @boolean -(string) @string -(int_number) @constant.numeric -(unit_type) @type.builtin [ "struct" "property" "callback" -"import" -"from" -"root" -"parent" -"this" -"for" "in" -"if" -"else if" -"else" "animate" "states" "when" -"in" "out" "transitions" "global" ] @keyword [ - "black" - "transparent" - "blue" - "ease" - "ease_in" - "ease-in" - "ease_in_out" - "ease-in-out" - "ease_out" - "ease-out" - "end" - "green" - "red" - "red" - "start" - "yellow" - "true" - "false" - ] @constant.builtin - -"@" @keyword - -; ; Punctuation +"black" +"transparent" +"blue" +"ease" +"ease_in" +"ease-in" +"ease_in_out" +"ease-in-out" +"ease_out" +"ease-out" +"end" +"green" +"red" +"red" +"start" +"yellow" +"white" +"gray" +] @constant.builtin + + +; Punctuation [ - "," - "." +"," +"." +";" +":" ] @punctuation.delimiter -; ; Brackets +; Brackets [ "(" ")" @@ -81,13 +110,13 @@ "}" ] @punctuation.bracket +(define_property ["<" ">"] @punctuation.bracket) + [ "angle" "bool" "brush" -; "color" // This causes problems -"duration" -"easing" +"color" "float" "image" "int" @@ -100,6 +129,7 @@ [ ":=" + "<=>" "!" "-" "+" @@ -118,8 +148,7 @@ "*=" "/=" "?" - "=>" ] @operator -(ternary_expression [":" "?"] @keyword.control.conditional) \ No newline at end of file +(ternary_expression [":" "?"] @conditional) \ No newline at end of file