Update slint grammar (#7893)

pull/7716/merge
Erasin Wang 1 year ago committed by GitHub
parent b0c270f8e6
commit 19dff5c3a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2029,7 +2029,7 @@ language-servers = [ "slint-lsp" ]
[[grammar]] [[grammar]]
name = "slint" name = "slint"
source = { git = "https://github.com/jrmoulton/tree-sitter-slint", rev = "0d4dda94f96623302dfc234e06be62a5717f47da" } source = { git = "https://github.com/jrmoulton/tree-sitter-slint", rev = "00c8a2d3645766f68c0d0460086c0a994e5b0d85" }
[[language]] [[language]]
name = "task" name = "task"

@ -1,45 +1,84 @@
(user_type_identifier) @type (identifier) @variable
[
(type_identifier)
(units)
]@type
(var_identifier) @variable (array_literal
(identifier) @type)
(state_identifier) @variable.other.member (function_identifier) @function
[
(image_macro)
(children_macro)
(radial_grad_macro)
(linear_grad_macro)
] @function.macro
(var_identifier (call_expression
(post_identifier) @variable) function: (identifier) @function)
(call_expression
function: (field_expression
field: (identifier) @function))
(function_identifier) @function (vis) @keyword.control.import
(reference_identifier) @keyword.storage.modifier.ref (transition_statement state: (identifier) @variable.other.member)
(visibility_modifier) @keyword.storage.modifier (state_expression state: (identifier) @variable.other.member)
(struct_block_definition field: (identifier) @variable.other.member)
(assign_property (identifier) @attribute)
(comment) @comment (comment) @comment
(string) @string (string_literal) @string
(int_number) @constant.numeric (int_literal) @constant.numeric.integer
(unit_type) @type.builtin (float_literal) @constant.numeric.float
[
"in"
"in-out"
"for"
] @keyword.control.repeat
[ [
"struct"
"property"
"callback"
"import" "import"
"export"
"from" "from"
"root" ] @keyword.control.import
"parent"
"this" [
"for"
"in"
"if" "if"
"else if"
"else" "else"
"when"
] @keyword.control.conditional
[
"struct"
"property"
] @keyword.storage.type
[
"global"
] @keyword.storage.modifier
[
"root"
"parent"
"duration"
"easing"
] @variable.builtin
[
"callback"
"animate" "animate"
"states" "states"
"when"
"in"
"out" "out"
"transitions" "transitions"
"global" "component"
"inherits"
] @keyword ] @keyword
[ [
@ -56,12 +95,16 @@
"end" "end"
"green" "green"
"red" "red"
"red"
"start" "start"
"yellow" "yellow"
"white"
"gray"
] @constant.builtin
[
"true" "true"
"false" "false"
] @constant.builtin ] @constant.builtin.boolean
"@" @keyword "@" @keyword
@ -69,6 +112,8 @@
[ [
"," ","
"." "."
";"
":"
] @punctuation.delimiter ] @punctuation.delimiter
; ; Brackets ; ; Brackets
@ -81,11 +126,13 @@
"}" "}"
] @punctuation.bracket ] @punctuation.bracket
(define_property ["<" ">"] @punctuation.bracket)
[ [
"angle" "angle"
"bool" "bool"
"brush" "brush"
; "color" // This causes problems "color"
"duration" "duration"
"easing" "easing"
"float" "float"
@ -100,6 +147,7 @@
[ [
":=" ":="
"<=>"
"!" "!"
"-" "-"
"+" "+"
@ -118,8 +166,6 @@
"*=" "*="
"/=" "/="
"?" "?"
"=>" ] @operator
"=>"
] @operator
(ternary_expression [":" "?"] @keyword.control.conditional) (ternary_expression [":" "?"] @keyword.control.conditional)

@ -1,11 +1,12 @@
[ [
(field_declaration_list_body) (comp_body)
(list_definition_body) (state_statement)
(struct_field_declaration_list_body) (transition_statement)
(handler_body)
(consequence_body)
(global_single)
] @indent ] @indent
[ [
"}" "}"
"]"
")"
] @outdent ] @outdent

@ -0,0 +1,2 @@
((comment) @injection.content
(#set! injection.language "comment"))

@ -1,3 +1,3 @@
; locals.scm ; locals.scm
(component_definition) @local.scope (component_item) @local.scope

Loading…
Cancel
Save