aboutsummaryrefslogtreecommitdiffstats
path: root/queries
diff options
context:
space:
mode:
authorIan Hobson <ian.r.hobson@gmail.com>2024-04-25 15:43:41 +0200
committerGitHub <noreply@github.com>2024-04-25 09:43:41 -0400
commit19c6b0c4c9b35962e45b782e2b85a3214d2ac4d5 (patch)
treee26a37f933ef9cf06f4c22b0c3b2be7f34a93914 /queries
parentfeat(rasi): Highlight captures similar to CSS (#6507) (diff)
downloadnvim-treesitter-19c6b0c4c9b35962e45b782e2b85a3214d2ac4d5.tar
nvim-treesitter-19c6b0c4c9b35962e45b782e2b85a3214d2ac4d5.tar.gz
nvim-treesitter-19c6b0c4c9b35962e45b782e2b85a3214d2ac4d5.tar.bz2
nvim-treesitter-19c6b0c4c9b35962e45b782e2b85a3214d2ac4d5.tar.lz
nvim-treesitter-19c6b0c4c9b35962e45b782e2b85a3214d2ac4d5.tar.xz
nvim-treesitter-19c6b0c4c9b35962e45b782e2b85a3214d2ac4d5.tar.zst
nvim-treesitter-19c6b0c4c9b35962e45b782e2b85a3214d2ac4d5.zip
feat: add koto
Co-authored-by: ObserverOfTime <chronobserver@disroot.org>
Diffstat (limited to 'queries')
-rw-r--r--queries/koto/folds.scm9
-rw-r--r--queries/koto/highlights.scm131
-rw-r--r--queries/koto/injections.scm2
-rw-r--r--queries/koto/locals.scm28
4 files changed, 170 insertions, 0 deletions
diff --git a/queries/koto/folds.scm b/queries/koto/folds.scm
new file mode 100644
index 000000000..d20d0120b
--- /dev/null
+++ b/queries/koto/folds.scm
@@ -0,0 +1,9 @@
+[
+ (assign)
+ (comment)
+ (function)
+ (list)
+ (map)
+ (tuple)
+ (string)
+] @fold
diff --git a/queries/koto/highlights.scm b/queries/koto/highlights.scm
new file mode 100644
index 000000000..021e504cf
--- /dev/null
+++ b/queries/koto/highlights.scm
@@ -0,0 +1,131 @@
+[
+ "="
+ "+"
+ "-"
+ "*"
+ "/"
+ "%"
+ "+="
+ "-="
+ "*="
+ "/="
+ "%="
+ "=="
+ "!="
+ "<"
+ ">"
+ "<="
+ ">="
+ ".."
+ "..="
+] @operator
+
+[
+ "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
diff --git a/queries/koto/injections.scm b/queries/koto/injections.scm
new file mode 100644
index 000000000..2f0e58eb6
--- /dev/null
+++ b/queries/koto/injections.scm
@@ -0,0 +1,2 @@
+((comment) @injection.content
+ (#set! injection.language "comment"))
diff --git a/queries/koto/locals.scm b/queries/koto/locals.scm
new file mode 100644
index 000000000..7c7097e14
--- /dev/null
+++ b/queries/koto/locals.scm
@@ -0,0 +1,28 @@
+; Scopes
+(function
+ body: (_) @local.scope)
+
+; Definitions
+(arg
+ (identifier) @local.definition.parameter)
+
+(assign
+ (identifier) @local.definition.var)
+
+(for_args
+ (identifier) @local.definition.var)
+
+(match_patterns
+ (identifier) @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