replace kdl tree-sitter to fix highlighting (#8652)
* replace kdl tree-sitter
* kdl: adopt highlights for new tree-sitter
* kdl: add indent queries
* kdl: add textobjects
* kdl: improve syntax highlighting
* kdl: update lang-support
* kdl: make indents more concise
---------
Co-authored-by: Constantin Gahr <constantin.gahr@ipp.mpg.de>
commit5c325fe342c26f31df495ec478a1d427270e8e42
authorcgahr <constantin.gahr+github@pm.me>
dateFri 3 Nov 2023, 22:21 (3 years ago)
parent70bbbd7
book/src/generated/lang-support.md+1−1
@@ -81,7 +81,7 @@
8181| jsx | ✓ | ✓ | ✓ | `typescript-language-server` |
8282| julia | ✓ | ✓ | ✓ | `julia` |
8383| just | ✓ | ✓ | ✓ | |
84−| kdl | ✓ | | | |
84+| kdl | ✓ | ✓ | ✓ | |
8585| kotlin | ✓ | | | `kotlin-language-server` |
8686| latex | ✓ | ✓ | | `texlab` |
8787| lean | ✓ | | | `lean` |
languages.toml+1−1
@@ -2340,7 +2340,7 @@ injection-regex = "kdl"
23402340
23412341[[grammar]]
23422342name = "kdl"
2343−source = { git = "https://github.com/Unoqwy/tree-sitter-kdl", rev = "e1cd292c6d15df6610484e1d4b5c987ecad52373" }
2343+source = { git = "https://github.com/amaanq/tree-sitter-kdl", rev = "3ca569b9f9af43593c24f9e7a21f02f43a13bb88" }
23442344
23452345[[language]]
23462346name = "xml"
runtime/queries/kdl/highlights.scm+4−4
@@ -1,12 +1,12 @@
1−(comment) @comment
21(single_line_comment) @comment
2+(multi_line_comment) @comment
33
44(node
5− name: (identifier) @function)
5+ (identifier) @variable)
6+
67(prop (identifier) @attribute)
7−(type) @type
88
9−(bare_identifier) @variable.other.member
9+(type (_) @type) @punctuation.bracket
1010
1111(keyword) @keyword
1212
runtime/queries/kdl/indents.scmnew file+3
@@ -0,0 +1,3 @@
1+(node_children) @indent
2+
3+ "}" @outdent
runtime/queries/kdl/textobjects.scmnew file+27
@@ -0,0 +1,27 @@
1+(type (_) @test.inside) @test.around
2+
3+(node
4+ children: (node_children)? @class.inside) @class.around
5+
6+(node
7+ children: (node_children)? @function.inside) @function.around
8+
9+(node (identifier) @function.movement)
10+
11+[
12+ (single_line_comment)
13+ (multi_line_comment)
14+] @comment.inside
15+
16+[
17+ (single_line_comment)+
18+ (multi_line_comment)+
19+] @comment.around
20+
21+[
22+ (prop)
23+ (value)
24+] @parameter.inside
25+
26+(value (type) ? (_) @parameter.inside @parameter.movement . ) @parameter.around
27+