Add Koto language support (#12307)
This commit is contained in:
parent
eaff0c3cd6
commit
06d0f33c94
8 changed files with 308 additions and 0 deletions
|
@ -115,6 +115,7 @@
|
|||
| kdl | ✓ | ✓ | ✓ | |
|
||||
| koka | ✓ | | ✓ | `koka` |
|
||||
| kotlin | ✓ | | | `kotlin-language-server` |
|
||||
| koto | ✓ | ✓ | ✓ | `koto-ls` |
|
||||
| latex | ✓ | ✓ | | `texlab` |
|
||||
| ld | ✓ | | ✓ | |
|
||||
| ldif | ✓ | | | |
|
||||
|
|
|
@ -53,6 +53,7 @@ jq-lsp = { command = "jq-lsp" }
|
|||
jsonnet-language-server = { command = "jsonnet-language-server", args= ["-t", "--lint"] }
|
||||
julia = { command = "julia", timeout = 60, args = [ "--startup-file=no", "--history-file=no", "--quiet", "-e", "using LanguageServer; runserver()", ] }
|
||||
koka = { command = "koka", args = ["--language-server", "--lsstdio"] }
|
||||
koto-ls = { command = "koto-ls" }
|
||||
kotlin-language-server = { command = "kotlin-language-server" }
|
||||
lean = { command = "lean", args = [ "--server", "--memory=1024" ] }
|
||||
ltex-ls = { command = "ltex-ls" }
|
||||
|
@ -3965,6 +3966,20 @@ indent = { tab-width = 4, unit = " " }
|
|||
name = "amber"
|
||||
source = { git = "https://github.com/amber-lang/tree-sitter-amber", rev = "c6df3ec2ec243ed76550c525e7ac3d9a10c6c814" }
|
||||
|
||||
[[language]]
|
||||
name = "koto"
|
||||
scope = "source.koto"
|
||||
injection-regex = "koto"
|
||||
file-types = ["koto"]
|
||||
comment-token = "#"
|
||||
block-comment-tokens = ["#-", "-#"]
|
||||
indent = { tab-width = 2, unit = " " }
|
||||
language-servers = ["koto-ls"]
|
||||
|
||||
[[grammar]]
|
||||
name = "koto"
|
||||
source = { git = "https://github.com/koto-lang/tree-sitter-koto", rev = "b420f7922d0d74905fd0d771e5b83be9ee8a8a9a" }
|
||||
|
||||
[[language]]
|
||||
name = "gpr"
|
||||
scope = "source.gpr"
|
||||
|
|
9
runtime/queries/koto/folds.scm
Normal file
9
runtime/queries/koto/folds.scm
Normal file
|
@ -0,0 +1,9 @@
|
|||
[
|
||||
(assign)
|
||||
(comment)
|
||||
(function)
|
||||
(list)
|
||||
(map)
|
||||
(tuple)
|
||||
(string)
|
||||
] @fold
|
152
runtime/queries/koto/highlights.scm
Normal file
152
runtime/queries/koto/highlights.scm
Normal file
|
@ -0,0 +1,152 @@
|
|||
[
|
||||
"="
|
||||
"+"
|
||||
"-"
|
||||
"*"
|
||||
"/"
|
||||
"%"
|
||||
"+="
|
||||
"-="
|
||||
"*="
|
||||
"/="
|
||||
"%="
|
||||
"=="
|
||||
"!="
|
||||
"<"
|
||||
">"
|
||||
"<="
|
||||
">="
|
||||
".."
|
||||
"..="
|
||||
"->"
|
||||
(null_check)
|
||||
] @operator
|
||||
|
||||
[
|
||||
"let"
|
||||
] @keyword
|
||||
|
||||
[
|
||||
"and"
|
||||
"not"
|
||||
"or"
|
||||
] @keyword.operator
|
||||
|
||||
[
|
||||
"return"
|
||||
"yield"
|
||||
] @keyword.control.return
|
||||
|
||||
[
|
||||
"if"
|
||||
"then"
|
||||
"else"
|
||||
"else if"
|
||||
"match"
|
||||
"switch"
|
||||
] @keyword.control.conditional
|
||||
|
||||
[
|
||||
(break)
|
||||
(continue)
|
||||
"for"
|
||||
"in"
|
||||
"loop"
|
||||
"until"
|
||||
"while"
|
||||
] @keyword.control.repeat
|
||||
|
||||
[
|
||||
"throw"
|
||||
"try"
|
||||
"catch"
|
||||
"finally"
|
||||
] @keyword.control.exception
|
||||
|
||||
[
|
||||
"export"
|
||||
"from"
|
||||
"import"
|
||||
"as"
|
||||
] @keyword.control.import
|
||||
|
||||
(string (interpolation ("{") @punctuation.special))
|
||||
(string (interpolation ("}") @punctuation.special))
|
||||
|
||||
[
|
||||
"("
|
||||
")"
|
||||
"["
|
||||
"]"
|
||||
"{"
|
||||
"}"
|
||||
"|"
|
||||
] @punctuation.bracket
|
||||
|
||||
[
|
||||
";"
|
||||
":"
|
||||
","
|
||||
] @punctuation.delimiter
|
||||
|
||||
(import_module
|
||||
(identifier) @module)
|
||||
|
||||
(import_item
|
||||
(identifier) @module)
|
||||
|
||||
(export
|
||||
(identifier) @module)
|
||||
|
||||
(call
|
||||
function: (identifier) @function.method)
|
||||
|
||||
(chain
|
||||
lookup: (identifier) @variable.other.member)
|
||||
|
||||
[
|
||||
(true)
|
||||
(false)
|
||||
] @constant.builtin.boolean
|
||||
|
||||
(comment) @comment
|
||||
|
||||
(debug) @keyword
|
||||
|
||||
(string) @string
|
||||
|
||||
(fill_char) @punctuation.delimiter
|
||||
|
||||
(alignment) @operator
|
||||
|
||||
(escape) @constant.character.escape
|
||||
|
||||
(null) @constant.builtin
|
||||
|
||||
(number) @constant.numeric
|
||||
|
||||
(meta) @keyword.directive
|
||||
|
||||
(meta
|
||||
name: (identifier) @variable.other.member)
|
||||
|
||||
(entry_inline
|
||||
key: (identifier) @variable.other.member)
|
||||
|
||||
(entry_block
|
||||
key: (identifier) @variable.other.member)
|
||||
|
||||
(self) @variable.builtin
|
||||
|
||||
(variable
|
||||
type: (identifier) @type)
|
||||
|
||||
(arg
|
||||
(_ (identifier) @variable.parameter))
|
||||
|
||||
(ellipsis) @variable.parameter
|
||||
|
||||
(function
|
||||
output_type: (identifier) @type)
|
||||
|
||||
(identifier) @variable
|
61
runtime/queries/koto/indents.scm
Normal file
61
runtime/queries/koto/indents.scm
Normal file
|
@ -0,0 +1,61 @@
|
|||
[
|
||||
(list)
|
||||
(map)
|
||||
(tuple)
|
||||
] @indent
|
||||
|
||||
[
|
||||
(for)
|
||||
(else_if)
|
||||
(else)
|
||||
(match)
|
||||
(switch)
|
||||
(until)
|
||||
(while)
|
||||
] @indent @extend
|
||||
|
||||
(assign
|
||||
"=" @indent @extend
|
||||
!rhs
|
||||
)
|
||||
(assign
|
||||
"=" @indent @extend
|
||||
rhs: (_) @anchor
|
||||
(#not-same-line? @indent @anchor)
|
||||
)
|
||||
|
||||
(if
|
||||
condition: (_) @indent @extend
|
||||
!then
|
||||
)
|
||||
(if
|
||||
condition: (_) @indent @extend
|
||||
then: (_) @anchor
|
||||
(#not-same-line? @indent @anchor)
|
||||
)
|
||||
|
||||
(function
|
||||
(args) @indent @extend
|
||||
!body
|
||||
)
|
||||
(function
|
||||
(args) @indent @extend
|
||||
body: (_) @anchor
|
||||
(#not-same-line? @indent @anchor)
|
||||
)
|
||||
|
||||
(match_arm
|
||||
"then" @indent @extend
|
||||
!then
|
||||
)
|
||||
(match_arm
|
||||
"then" @indent @extend
|
||||
then: (_) @anchor
|
||||
(#not-same-line? @indent @anchor)
|
||||
)
|
||||
|
||||
[
|
||||
"}"
|
||||
"]"
|
||||
")"
|
||||
] @outdent
|
2
runtime/queries/koto/injections.scm
Normal file
2
runtime/queries/koto/injections.scm
Normal file
|
@ -0,0 +1,2 @@
|
|||
((comment) @injection.content
|
||||
(#set! injection.language "comment"))
|
30
runtime/queries/koto/locals.scm
Normal file
30
runtime/queries/koto/locals.scm
Normal file
|
@ -0,0 +1,30 @@
|
|||
; Scopes
|
||||
(module (_) @local.scope)
|
||||
|
||||
(function
|
||||
body: (_) @local.scope)
|
||||
|
||||
; Definitions
|
||||
(assign
|
||||
lhs: (identifier) @local.definition)
|
||||
|
||||
(variable
|
||||
(identifier) @local.definition)
|
||||
|
||||
(arg
|
||||
(identifier) @local.definition)
|
||||
|
||||
(arg
|
||||
(variable (identifier)) @local.definition)
|
||||
|
||||
(import_item
|
||||
(identifier) @local.definition)
|
||||
|
||||
(entry_block
|
||||
(identifier) @local.definition)
|
||||
|
||||
(entry_inline
|
||||
(identifier) @local.definition)
|
||||
|
||||
; References
|
||||
(identifier) @local.reference
|
38
runtime/queries/koto/textobjects.scm
Normal file
38
runtime/queries/koto/textobjects.scm
Normal file
|
@ -0,0 +1,38 @@
|
|||
(comment) @comment.inside
|
||||
|
||||
(comment)+ @comment.around
|
||||
|
||||
(function
|
||||
body: (_) @function.inside) @function.around
|
||||
|
||||
(args
|
||||
((arg) @parameter.inside . ","? @parameter.around) @parameter.around)
|
||||
|
||||
(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)
|
||||
|
||||
(map_block
|
||||
((entry_block) @entry.inside) @entry.around)
|
||||
|
||||
(list
|
||||
((element) @entry.inside . ","? @entry.around) @entry.around)
|
||||
|
||||
(tuple
|
||||
(_) @entry.around)
|
||||
|
||||
(assign
|
||||
(meta (test))
|
||||
(function body: (_) @test.inside)
|
||||
) @test.around
|
||||
|
||||
(entry_block
|
||||
key: (meta (test))
|
||||
value: (function body: (_) @test.inside)
|
||||
) @test.around
|
Loading…
Reference in a new issue