Unnamed repository; edit this file 'description' to name the repository.
Update Koto grammar and queries, add formatter (#14049)
Ian Hobson 7 months ago
parent b01fbb4 · commit 1e4bf67
-rw-r--r--languages.toml3
-rw-r--r--runtime/queries/koto/highlights.scm19
-rw-r--r--runtime/queries/koto/textobjects.scm4
3 files changed, 14 insertions, 12 deletions
diff --git a/languages.toml b/languages.toml
index 1fb13f05..011ceaf7 100644
--- a/languages.toml
+++ b/languages.toml
@@ -4243,10 +4243,11 @@ comment-token = "#"
block-comment-tokens = ["#-", "-#"]
indent = { tab-width = 2, unit = " " }
language-servers = ["koto-ls"]
+formatter = {command = "koto", args = ["--format"]}
[[grammar]]
name = "koto"
-source = { git = "https://github.com/koto-lang/tree-sitter-koto", rev = "b420f7922d0d74905fd0d771e5b83be9ee8a8a9a" }
+source = { git = "https://github.com/koto-lang/tree-sitter-koto", rev = "2ffc77c14f0ac1674384ff629bfc207b9c57ed89" }
[[language]]
name = "gpr"
diff --git a/runtime/queries/koto/highlights.scm b/runtime/queries/koto/highlights.scm
index de0971b1..b1dd990e 100644
--- a/runtime/queries/koto/highlights.scm
+++ b/runtime/queries/koto/highlights.scm
@@ -5,11 +5,13 @@
"*"
"/"
"%"
+ "^"
"+="
"-="
"*="
"/="
"%="
+ "^="
"=="
"!="
"<"
@@ -99,12 +101,18 @@
(export
(identifier) @namespace)
-(call
- function: (identifier) @function.method)
+(chain
+ start: (identifier) @function)
(chain
lookup: (identifier) @variable.other.member)
+(call
+ function: (identifier)) @function
+
+(call_arg
+ (identifier) @variable.other.member)
+
[
(true)
(false)
@@ -139,13 +147,10 @@
(self) @variable.builtin
-(variable
- type: (identifier) @type)
+(type
+ _ @type)
(arg
(_ (identifier) @variable.parameter))
(ellipsis) @variable.parameter
-
-(function
- output_type: (identifier) @type)
diff --git a/runtime/queries/koto/textobjects.scm b/runtime/queries/koto/textobjects.scm
index 15455689..c997b5cf 100644
--- a/runtime/queries/koto/textobjects.scm
+++ b/runtime/queries/koto/textobjects.scm
@@ -11,10 +11,6 @@
(call_args
((call_arg) @parameter.inside . ","? @parameter.around) @parameter.around)
-(chain
- call: (tuple
- ((element) @parameter.inside . ","? @parameter.around) @parameter.around))
-
(map
((entry_inline) @entry.inside . ","? @entry.around) @entry.around)