aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJared Moulton <jaredmoulton3@gmail.com>2022-03-07 16:10:31 -0700
committerGitHub <noreply@github.com>2022-03-07 23:10:31 +0000
commitcc4f373bb4a2a1057479e1d08d46d740717b32a3 (patch)
tree8d16082a30a758b34c71d62c47adaa81f4e1f888
parentUpdate lockfile.json (diff)
downloadnvim-treesitter-cc4f373bb4a2a1057479e1d08d46d740717b32a3.tar
nvim-treesitter-cc4f373bb4a2a1057479e1d08d46d740717b32a3.tar.gz
nvim-treesitter-cc4f373bb4a2a1057479e1d08d46d740717b32a3.tar.bz2
nvim-treesitter-cc4f373bb4a2a1057479e1d08d46d740717b32a3.tar.lz
nvim-treesitter-cc4f373bb4a2a1057479e1d08d46d740717b32a3.tar.xz
nvim-treesitter-cc4f373bb4a2a1057479e1d08d46d740717b32a3.tar.zst
nvim-treesitter-cc4f373bb4a2a1057479e1d08d46d740717b32a3.zip
Add slint parser configuration and queries (#2598)
* Add slint parser * Mark slint as experimental * Remove filetype and add slint to the lockfile * Update queries * Update varibable.builtin's and repeats * Update slint true false * Change export back to keyword * Change export back to include :)
-rw-r--r--lockfile.json3
-rw-r--r--lua/nvim-treesitter/parsers.lua10
-rw-r--r--queries/slint/highlights.scm115
-rw-r--r--queries/slint/indents.scm13
4 files changed, 141 insertions, 0 deletions
diff --git a/lockfile.json b/lockfile.json
index 1705ecb04..4b3187097 100644
--- a/lockfile.json
+++ b/lockfile.json
@@ -251,6 +251,9 @@
"supercollider": {
"revision": "0f0e5b5a96dd3e048a9c3db648ed969c44068bff"
},
+ "slint": {
+ "revision": "0d4dda94f96623302dfc234e06be62a5717f47da"
+ },
"surface": {
"revision": "f4586b35ac8548667a9aaa4eae44456c1f43d032"
},
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index 3c8cc8daf..0cd7cab9f 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -461,6 +461,16 @@ list.supercollider = {
filetype = "supercollider",
}
+list.slint = {
+ install_info = {
+ url = "https://github.com/jrmoulton/tree-sitter-slint",
+ files = { "src/parser.c" },
+ branch = "main",
+ },
+ maintainers = { "@jrmoulton" },
+ experimental = true,
+}
+
list.haskell = {
install_info = {
url = "https://github.com/tree-sitter/tree-sitter-haskell",
diff --git a/queries/slint/highlights.scm b/queries/slint/highlights.scm
new file mode 100644
index 000000000..7372f331c
--- /dev/null
+++ b/queries/slint/highlights.scm
@@ -0,0 +1,115 @@
+
+(user_type_identifier) @type
+
+(var_identifier) @variable
+
+(state_identifier) @field
+
+(var_identifier
+ (post_identifier) @variable)
+
+(function_identifier) @function
+
+(reference_identifier) @keyword
+(visibility_modifier) @include
+
+(comment) @comment
+
+(value) @number
+(string) @string
+
+[
+"in"
+"for"
+] @repeat
+
+"@" @keyword
+
+[
+"import"
+"from"
+] @include
+
+[
+"if"
+"else"
+] @conditional
+
+[
+"root"
+"parent"
+"this"
+] @variable.builtin
+
+[
+"true"
+"false"
+] @boolean
+
+
+[
+"struct"
+"property"
+"callback"
+"in"
+"animate"
+"states"
+"when"
+"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"
+ ] @constant.builtin
+
+
+; 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
+
diff --git a/queries/slint/indents.scm b/queries/slint/indents.scm
new file mode 100644
index 000000000..30761ef8f
--- /dev/null
+++ b/queries/slint/indents.scm
@@ -0,0 +1,13 @@
+
+[
+(field_declaration_list_body)
+(list_definition_body)
+(struct_field_declaration_list_body)
+] @indent
+
+"}" @indent_end
+
+(comment) @auto
+
+(string) @auto
+