aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2026-09-09 16:56:20 +0200
committerChristian Clason <ch.clason+github@icloud.com>2026-09-11 18:58:50 +0200
commitde9f0f3dbdab1952f136dc7bd67ff3bafdf994da (patch)
tree86b06236e944c045d15205a6dc3273c547a74c94
parentdocs: drop query maintainers (diff)
downloadnvim-treesitter-de9f0f3dbdab1952f136dc7bd67ff3bafdf994da.tar
nvim-treesitter-de9f0f3dbdab1952f136dc7bd67ff3bafdf994da.tar.gz
nvim-treesitter-de9f0f3dbdab1952f136dc7bd67ff3bafdf994da.tar.bz2
nvim-treesitter-de9f0f3dbdab1952f136dc7bd67ff3bafdf994da.tar.lz
nvim-treesitter-de9f0f3dbdab1952f136dc7bd67ff3bafdf994da.tar.xz
nvim-treesitter-de9f0f3dbdab1952f136dc7bd67ff3bafdf994da.tar.zst
nvim-treesitter-de9f0f3dbdab1952f136dc7bd67ff3bafdf994da.zip
feat(kdl)!: update parser and queries
Also mark as Tier 1.
-rw-r--r--SUPPORTED_LANGUAGES.md2
-rw-r--r--lua/nvim-treesitter/parsers.lua4
-rw-r--r--runtime/queries/kdl/highlights.scm57
-rw-r--r--runtime/queries/kdl/indents.scm3
-rw-r--r--runtime/queries/kdl/locals.scm8
5 files changed, 43 insertions, 31 deletions
diff --git a/SUPPORTED_LANGUAGES.md b/SUPPORTED_LANGUAGES.md
index a28eb628d..367c3bad0 100644
--- a/SUPPORTED_LANGUAGES.md
+++ b/SUPPORTED_LANGUAGES.md
@@ -155,7 +155,7 @@ jsx (queries only)[^jsx] | unstable | `HFIJ `
[just](https://github.com/IndianBoy42/tree-sitter-just) | unstable | `HFIJL`
[kcl](https://github.com/kcl-lang/tree-sitter-kcl) | unstable | `HF J `
[kconfig](https://github.com/tree-sitter-grammars/tree-sitter-kconfig) | unstable | `HFIJL`
-[kdl](https://github.com/tree-sitter-grammars/tree-sitter-kdl) | unstable | `HFIJL`
+[kdl](https://github.com/tree-sitter-grammars/tree-sitter-kdl) | stable | `HFIJL`
[kitty](https://github.com/OXY2DEV/tree-sitter-kitty) | unstable | `H  J `
[kos](https://github.com/kos-lang/tree-sitter-kos) | unstable | `HF JL`
[kotlin](https://github.com/fwcd/tree-sitter-kotlin) | unstable | `HF JL`
diff --git a/lua/nvim-treesitter/parsers.lua b/lua/nvim-treesitter/parsers.lua
index 54655c920..75ab3601a 100644
--- a/lua/nvim-treesitter/parsers.lua
+++ b/lua/nvim-treesitter/parsers.lua
@@ -1041,10 +1041,10 @@ return {
},
kdl = {
install_info = {
- revision = 'b37e3d58e5c5cf8d739b315d6114e02d42e66664',
+ revision = 'v2.0.0',
url = 'https://github.com/tree-sitter-grammars/tree-sitter-kdl',
},
- tier = 2,
+ tier = 1,
},
kitty = {
install_info = {
diff --git a/runtime/queries/kdl/highlights.scm b/runtime/queries/kdl/highlights.scm
index 7d200c85e..72a8ca395 100644
--- a/runtime/queries/kdl/highlights.scm
+++ b/runtime/queries/kdl/highlights.scm
@@ -1,33 +1,51 @@
-; Types
; Variables
(identifier) @variable
; Nodes
(node
- (identifier) @tag)
+ name: (identifier) @tag)
+
+(node
+ name: (identifier
+ (string) @tag))
+
+; Types
+(type) @type
-; Type annotation
(type
- (identifier) @type)
+ name: (identifier) @type)
+
+; Reserved type annotations are advisory in the spec, not syntax.
+((type
+ name: (identifier) @type.builtin)
+ (#any-of? @type.builtin
+ "i8" "i16" "i32" "i64" "i128" "u8" "u16" "u32" "u64" "u128" "isize" "usize" "f32" "f64"
+ "decimal64" "decimal128" "date-time" "time" "date" "duration" "decimal" "currency" "country-2"
+ "country-3" "country-subdivision" "email" "idn-email" "hostname" "idn-hostname" "ipv4" "ipv6"
+ "url" "url-reference" "irl" "irl-reference" "url-template" "uuid" "regex" "base64" "base85"))
; Properties
(prop
- (identifier) @property)
+ key: (identifier) @property)
; Operators
-[
- "="
- "+"
- "-"
-] @operator
+"=" @operator
; Literals
(string) @string
+(multi_line_string) @string
+
+(string_fragment) @string
+
(escape) @string.escape
+(escaped_whitespace) @string.escape
+
(number) @number
+(keyword_number) @number
+
(number
(decimal) @number.float)
@@ -36,7 +54,10 @@
(boolean) @boolean
-"null" @constant.builtin
+[
+ "null"
+ "#null"
+] @constant.builtin
; Punctuation
[
@@ -55,17 +76,11 @@
[
(single_line_comment)
(multi_line_comment)
+ (version)
] @comment @spell
-(node
- (node_comment)
- (#set! priority 105)) @comment
+(node_comment) @comment
-(node
- (node_field
- (node_field_comment)
- (#set! priority 105)) @comment)
+(node_field_comment) @comment
-(node_children
- (node_children_comment)
- (#set! priority 105)) @comment
+(node_children_comment) @comment
diff --git a/runtime/queries/kdl/indents.scm b/runtime/queries/kdl/indents.scm
index 6d16efd2d..cf4620ac2 100644
--- a/runtime/queries/kdl/indents.scm
+++ b/runtime/queries/kdl/indents.scm
@@ -1,5 +1,4 @@
-(node
- (node_children) @indent.begin)
+(node_children) @indent.begin
"}" @indent.end
diff --git a/runtime/queries/kdl/locals.scm b/runtime/queries/kdl/locals.scm
index 14b0af23e..9435bef0d 100644
--- a/runtime/queries/kdl/locals.scm
+++ b/runtime/queries/kdl/locals.scm
@@ -1,16 +1,14 @@
(document) @local.scope
-(node
- (node_children) @local.scope)
+(node_children) @local.scope
-(node_children
- (node) @local.scope)
+(node) @local.scope
(identifier) @local.reference
(node_field) @local.definition.field
(node
- (identifier) @local.definition.type)
+ name: (identifier) @local.definition.type)
(type) @local.definition.type