aboutsummaryrefslogtreecommitdiffstats
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
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>
-rw-r--r--README.md1
-rw-r--r--lockfile.json3
-rw-r--r--lua/nvim-treesitter/parsers.lua8
-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
7 files changed, 182 insertions, 0 deletions
diff --git a/README.md b/README.md
index 2bf7c9175..2eea8f14b 100644
--- a/README.md
+++ b/README.md
@@ -294,6 +294,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [kconfig](https://github.com/amaanq/tree-sitter-kconfig) (maintained by @amaanq)
- [x] [kdl](https://github.com/amaanq/tree-sitter-kdl) (maintained by @amaanq)
- [x] [kotlin](https://github.com/fwcd/tree-sitter-kotlin) (maintained by @SalBakraa)
+- [x] [koto](https://github.com/koto-lang/tree-sitter-koto) (maintained by @irh)
- [x] [kusto](https://github.com/Willem-J-an/tree-sitter-kusto) (maintained by @Willem-J-an)
- [x] [lalrpop](https://github.com/traxys/tree-sitter-lalrpop) (maintained by @traxys)
- [x] [latex](https://github.com/latex-lsp/tree-sitter-latex) (maintained by @theHamsta, @clason)
diff --git a/lockfile.json b/lockfile.json
index fbb7fbe6e..16bc7720c 100644
--- a/lockfile.json
+++ b/lockfile.json
@@ -362,6 +362,9 @@
"kotlin": {
"revision": "260afd9a92bac51b3a4546303103c3d40a430639"
},
+ "koto": {
+ "revision": "85e689c17abab691e033080da726a792b3711df0"
+ },
"kusto": {
"revision": "8353a1296607d6ba33db7c7e312226e5fc83e8ce"
},
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index 18f5ceb63..c6f169d63 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -1082,6 +1082,14 @@ list.kotlin = {
maintainers = { "@SalBakraa" },
}
+list.koto = {
+ install_info = {
+ url = "https://github.com/koto-lang/tree-sitter-koto",
+ files = { "src/parser.c", "src/scanner.c" },
+ },
+ maintainers = { "@irh" },
+}
+
list.kusto = {
install_info = {
url = "https://github.com/Willem-J-an/tree-sitter-kusto",
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