aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/queries/koto
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2023-06-12 09:54:30 -0600
committerChristian Clason <c.clason@uni-graz.at>2025-05-12 18:43:40 +0200
commit692b051b09935653befdb8f7ba8afdb640adf17b (patch)
tree167162b6b129ae04f68c5735078521a72917c742 /runtime/queries/koto
parentfeat(c-family): inherit injections (diff)
downloadnvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.gz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.bz2
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.lz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.xz
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.tar.zst
nvim-treesitter-692b051b09935653befdb8f7ba8afdb640adf17b.zip
feat!: drop modules, general refactor and cleanup
Diffstat (limited to 'runtime/queries/koto')
-rw-r--r--runtime/queries/koto/folds.scm9
-rw-r--r--runtime/queries/koto/highlights.scm138
-rw-r--r--runtime/queries/koto/injections.scm2
-rw-r--r--runtime/queries/koto/locals.scm28
4 files changed, 177 insertions, 0 deletions
diff --git a/runtime/queries/koto/folds.scm b/runtime/queries/koto/folds.scm
new file mode 100644
index 000000000..d20d0120b
--- /dev/null
+++ b/runtime/queries/koto/folds.scm
@@ -0,0 +1,9 @@
+[
+ (assign)
+ (comment)
+ (function)
+ (list)
+ (map)
+ (tuple)
+ (string)
+] @fold
diff --git a/runtime/queries/koto/highlights.scm b/runtime/queries/koto/highlights.scm
new file mode 100644
index 000000000..bd6ce8d0e
--- /dev/null
+++ b/runtime/queries/koto/highlights.scm
@@ -0,0 +1,138 @@
+[
+ "="
+ "+"
+ "-"
+ "*"
+ "/"
+ "%"
+ "+="
+ "-="
+ "*="
+ "/="
+ "%="
+ "=="
+ "!="
+ "<"
+ ">"
+ "<="
+ ">="
+ ".."
+ "..="
+ "->"
+ (null_check)
+] @operator
+
+"let" @keyword
+
+[
+ "and"
+ "not"
+ "or"
+] @keyword.operator
+
+[
+ "return"
+ "yield"
+] @keyword.return
+
+[
+ "if"
+ "then"
+ "else"
+ "else if"
+ "match"
+ "switch"
+] @keyword.conditional
+
+[
+ (break)
+ (continue)
+ "for"
+ "in"
+ "loop"
+ "until"
+ "while"
+] @keyword.repeat
+
+[
+ "throw"
+ "try"
+ "catch"
+ "finally"
+] @keyword.exception
+
+[
+ "export"
+ "from"
+ "import"
+ "as"
+] @keyword.import
+
+[
+ "("
+ ")"
+ "["
+ "]"
+ "{"
+ "}"
+ "|"
+] @punctuation.bracket
+
+(identifier) @variable
+
+(import_module
+ (identifier) @module)
+
+(import_item
+ (identifier) @module)
+
+(export
+ (identifier) @module)
+
+(chain
+ lookup: (identifier) @variable.member)
+
+(chain
+ start: (identifier) @function.call)
+
+[
+ (true)
+ (false)
+] @boolean
+
+(comment) @comment @spell
+
+(debug) @keyword.debug
+
+(string) @string
+
+(fill_char) @punctuation.delimiter
+
+(alignment) @operator
+
+(escape) @string.escape
+
+(null) @constant.builtin
+
+(number) @number
+
+(meta) @keyword.directive
+
+(meta
+ name: (identifier) @variable.member)
+
+(entry_inline
+ key: (identifier) @variable.member)
+
+(entry_block
+ key: (identifier) @variable.member)
+
+(self) @variable.builtin
+
+(arg
+ (identifier) @variable.parameter)
+
+(ellipsis) @variable.parameter
+
+(type
+ _ @type)
diff --git a/runtime/queries/koto/injections.scm b/runtime/queries/koto/injections.scm
new file mode 100644
index 000000000..2f0e58eb6
--- /dev/null
+++ b/runtime/queries/koto/injections.scm
@@ -0,0 +1,2 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))
diff --git a/runtime/queries/koto/locals.scm b/runtime/queries/koto/locals.scm
new file mode 100644
index 000000000..c18487483
--- /dev/null
+++ b/runtime/queries/koto/locals.scm
@@ -0,0 +1,28 @@
+; Scopes
+(function
+ body: (_) @local.scope)
+
+; Definitions
+(arg
+ (variable) @local.definition.parameter)
+
+(assign
+ (identifier) @local.definition.var)
+
+(for_args
+ (variable) @local.definition.var)
+
+(match_patterns
+ (variable) @local.definition.var)
+
+(import_item
+ (identifier) @local.definition.import)
+
+(entry_block
+ (identifier) @local.definition.field)
+
+(entry_inline
+ (identifier) @local.definition.field)
+
+; References
+(identifier) @local.reference