aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaden2022-10-29 15:33:23 +0000
committerGitHub2022-10-29 15:33:23 +0000
commitb5e7501935472f4e68bf42ac9759d54688ccb5e6 (patch)
tree720e8d8d23f23658377ff514c156c4a7b29bf2f7
parent5e256e4a98561c2085b1ecae1e39e27bf3744724 (diff)
feat(lang): add kdl grammar (#4481)
-rw-r--r--book/src/generated/lang-support.md1
-rw-r--r--languages.toml12
-rw-r--r--runtime/queries/kdl/highlights.scm22
3 files changed, 35 insertions, 0 deletions
diff --git a/book/src/generated/lang-support.md b/book/src/generated/lang-support.md
index c166af29..ee54114a 100644
--- a/book/src/generated/lang-support.md
+++ b/book/src/generated/lang-support.md
@@ -60,6 +60,7 @@
| jsonnet | ✓ | | | `jsonnet-language-server` |
| jsx | ✓ | ✓ | ✓ | `typescript-language-server` |
| julia | ✓ | | | `julia` |
+| kdl | ✓ | | | |
| kotlin | ✓ | | | `kotlin-language-server` |
| latex | ✓ | ✓ | | `texlab` |
| lean | ✓ | | | `lean` |
diff --git a/languages.toml b/languages.toml
index c5c45afc..31a454b0 100644
--- a/languages.toml
+++ b/languages.toml
@@ -1885,3 +1885,15 @@ grammar = "vhs"
[[grammar]]
name = "vhs"
source = { git = "https://github.com/charmbracelet/tree-sitter-vhs", rev = "c6d81f34c011c29ee86dd73b45a8ecc9f2e2bdaf" }
+
+[[language]]
+name = "kdl"
+scope = "source.kdl"
+file-types = ["kdl"]
+roots = []
+comment-token = "//"
+injection-regex = "kdl"
+
+[[grammar]]
+name = "kdl"
+source = { git = "https://github.com/Unoqwy/tree-sitter-kdl", rev = "e1cd292c6d15df6610484e1d4b5c987ecad52373" }
diff --git a/runtime/queries/kdl/highlights.scm b/runtime/queries/kdl/highlights.scm
new file mode 100644
index 00000000..d83bde19
--- /dev/null
+++ b/runtime/queries/kdl/highlights.scm
@@ -0,0 +1,22 @@
+(comment) @comment
+(single_line_comment) @comment
+
+(node
+ name: (identifier) @function)
+(prop (identifier) @attribute)
+(type) @type
+
+(bare_identifier) @variable.other.member
+
+(keyword) @keyword
+
+(string) @string
+(number) @constant.numeric
+(boolean) @constant.builtin.boolean
+
+"." @punctuation.delimiter
+
+"=" @operator
+
+"{" @punctuation.bracket
+"}" @punctuation.bracket