aboutsummaryrefslogtreecommitdiff
path: root/runtime/queries
diff options
context:
space:
mode:
authorErasin2022-08-08 10:04:18 +0000
committerMichael Davis2022-08-08 22:57:08 +0000
commitf09d2bc56bfb8f5865ed364de371dad571e6a92f (patch)
tree0b7a5da49ca940aa81a2c79259758cec59ed0f45 /runtime/queries
parent3e11017ade8b25e580b20dab5187374fa3338bae (diff)
Add slint-ui support
<https://slint-ui.com/> lsp: <https://github.com/slint-ui/slint/tree/HEAD/tools/lsp> tree-sitter-slint: <https://github.com/jrmoulton/tree-sitter-slint>
Diffstat (limited to 'runtime/queries')
-rw-r--r--runtime/queries/slint/highlights.scm125
-rw-r--r--runtime/queries/slint/indents.scm29
-rw-r--r--runtime/queries/slint/locals.scm3
3 files changed, 157 insertions, 0 deletions
diff --git a/runtime/queries/slint/highlights.scm b/runtime/queries/slint/highlights.scm
new file mode 100644
index 00000000..c7773913
--- /dev/null
+++ b/runtime/queries/slint/highlights.scm
@@ -0,0 +1,125 @@
+
+(user_type_identifier) @type
+
+(var_identifier) @variable
+
+(state_identifier) @variable.other.member
+
+(var_identifier
+ (post_identifier) @variable)
+
+(function_identifier) @function
+
+(reference_identifier) @keyword.storage.modifier.ref
+(visibility_modifier) @keyword.storage.modifier
+
+(comment) @comment
+
+(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
+[
+ ","
+ "."
+] @punctuation.delimiter
+
+; ; Brackets
+[
+"("
+")"
+"["
+"]"
+"{"
+"}"
+] @punctuation.bracket
+
+[
+"angle"
+"bool"
+"brush"
+; "color" // This causes problems
+"duration"
+"easing"
+"float"
+"image"
+"int"
+"length"
+"percent"
+"physical-length"
+"physical_length"
+"string"
+] @type.builtin
+
+[
+ ":="
+ "!"
+ "-"
+ "+"
+ "*"
+ "/"
+ "&&"
+ "||"
+ ">"
+ "<"
+ ">="
+ "<="
+ "="
+ ":"
+ "+="
+ "-="
+ "*="
+ "/="
+ "?"
+
+ "=>"
+ ] @operator
+
+(ternary_expression [":" "?"] @keyword.control.conditional) \ No newline at end of file
diff --git a/runtime/queries/slint/indents.scm b/runtime/queries/slint/indents.scm
new file mode 100644
index 00000000..253b9c48
--- /dev/null
+++ b/runtime/queries/slint/indents.scm
@@ -0,0 +1,29 @@
+
+; [
+; (struct_definition)
+; (component_definition)
+; ] @indent
+
+[
+(field_declaration_list_body)
+(list_definition_body)
+(struct_field_declaration_list_body)
+] @indent
+
+; [
+; "{"
+; "}"
+; "("
+; ")"
+; (if_statement)
+; "else if"
+; "else"
+; ] @branch
+
+; "{" @indent
+"}" @indent_end
+
+(comment) @auto
+
+(string) @auto
+
diff --git a/runtime/queries/slint/locals.scm b/runtime/queries/slint/locals.scm
new file mode 100644
index 00000000..feba5ebb
--- /dev/null
+++ b/runtime/queries/slint/locals.scm
@@ -0,0 +1,3 @@
+; locals.scm
+
+(component_definition) @local.scope