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,105 +1,153 @@
(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
[
"import"
"export"
"from"
] @keyword.control.import
[
"if"
"else"
"when"
] @keyword.control.conditional
[
"struct"
"property"
] @keyword.storage.type
[
"global"
] @keyword.storage.modifier
[ [
"struct" "root"
"property" "parent"
"callback" "duration"
"import" "easing"
"from" ] @variable.builtin
"root"
"parent"
"this" [
"for" "callback"
"in" "animate"
"if" "states"
"else if" "out"
"else" "transitions"
"animate" "component"
"states" "inherits"
"when"
"in"
"out"
"transitions"
"global"
] @keyword ] @keyword
[ [
"black" "black"
"transparent" "transparent"
"blue" "blue"
"ease" "ease"
"ease_in" "ease_in"
"ease-in" "ease-in"
"ease_in_out" "ease_in_out"
"ease-in-out" "ease-in-out"
"ease_out" "ease_out"
"ease-out" "ease-out"
"end" "end"
"green" "green"
"red" "red"
"red" "start"
"start" "yellow"
"yellow" "white"
"true" "gray"
"false"
] @constant.builtin ] @constant.builtin
[
"true"
"false"
] @constant.builtin.boolean
"@" @keyword "@" @keyword
; ; Punctuation ; ; Punctuation
[ [
"," ","
"." "."
";"
":"
] @punctuation.delimiter ] @punctuation.delimiter
; ; Brackets ; ; Brackets
[ [
"(" "("
")" ")"
"[" "["
"]" "]"
"{" "{"
"}" "}"
] @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"
"image" "image"
"int" "int"
"length" "length"
"percent" "percent"
"physical-length" "physical-length"
"physical_length" "physical_length"
"string" "string"
] @type.builtin ] @type.builtin
[ [
":=" ":="
"<=>"
"!" "!"
"-" "-"
"+" "+"
@ -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