Unnamed repository; edit this file 'description' to name the repository.
| -rw-r--r-- | book/src/generated/lang-support.md | 1 | ||||
| -rw-r--r-- | languages.toml | 19 | ||||
| -rw-r--r-- | runtime/queries/kcl/highlights.scm | 57 |
3 files changed, 77 insertions, 0 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md index 67cd39c1..690a7f27 100644 --- a/book/src/generated/lang-support.md +++ b/book/src/generated/lang-support.md @@ -141,6 +141,7 @@ | jsx | ✓ | ✓ | ✓ | ✓ | ✓ | `typescript-language-server` | | julia | ✓ | ✓ | ✓ | | | `julia` | | just | ✓ | ✓ | ✓ | ✓ | | `just-lsp` | +| kcl | ✓ | | | | | `kcl-language-server` | | kconfig | ✓ | | ✓ | | | | | kdl | ✓ | ✓ | ✓ | ✓ | | | | koka | ✓ | | ✓ | | | `koka` | diff --git a/languages.toml b/languages.toml index c596d630..411bc07a 100644 --- a/languages.toml +++ b/languages.toml @@ -284,6 +284,10 @@ args = ["lsp"] command = "docker-language-server" args = ["start", "--stdio"] +[language-server.kcl-lsp] +command = "kcl-language-server" +args = ["server", "--stdio"] + [[language]] name = "rust" scope = "source.rust" @@ -4892,3 +4896,18 @@ indent = { tab-width = 2, unit = " " } [[grammar]] name = "nearley" source = { git = "https://github.com/mi2ebi/tree-sitter-nearley", rev = "12d01113e194c8e83f6341aab8c2a5f21db9cac9" } + +[[language]] +name = "kcl" +scope = "source.kcl" +injection-regex = "kcl" +file-types = ["kcl"] +comment-tokens = "//" +indent = { tab-width = 2, unit = " " } +formatter = { command = "zoo" , args = ["kcl", "fmt", "-"] } +language-servers = [ "kcl-lsp" ] +block-comment-tokens = { start = "/*", end = "*/"} + +[[grammer]] +name = "kcl" +source = { git = "https://github.com/KittyCAD/tree-sitter-kcl", rev = "8905e0bdbf5870b50bc3f24345f1af27746f42e8"} diff --git a/runtime/queries/kcl/highlights.scm b/runtime/queries/kcl/highlights.scm new file mode 100644 index 00000000..61c24ade --- /dev/null +++ b/runtime/queries/kcl/highlights.scm @@ -0,0 +1,57 @@ +;; Maps AST nodes (left) to highlighting classes (right) +;; See https://docs.helix-editor.com/themes.html#scopes +;; for the supported scopes. +;; Don't forget to run the command `hx --grammar fetch` to fetch the grammars, +;; and `hx --grammar build` to build any out-of-date grammars. + +"fn" @keyword.function +"return" @keyword.control.return +"import" @keyword.control.import +"export" @keyword.control.import +[ + "if" + "else" + ] @keyword.control.conditional +(identifier) @variable + +;; highlight type names +(type_name + (identifier) @type +) @type + +(fn_call + callee: (identifier) @function + (labeledArg + label: (identifier) @variable.parameter + ) +) + + +;; operators +(binary_operator) @operator +(prefix_operator) @operator + +;; punctuation + +; ".." @punctuation.special + +"(" @punctuation.bracket +")" @punctuation.bracket +"[" @punctuation.bracket +"]" @punctuation.bracket +"{" @punctuation.bracket +"}" @punctuation.bracket + +; "." @punctuation.delimiter +"," @punctuation.delimiter +; ":" @punctuation.delimiter +; ";" @punctuation.delimiter + +;; literals +(boolean) @constant.builtin.boolean +(string) @string +(number) @constant.numeric + +;; comments +(shebang) @keyword.directive +(comment) @comment |