feat: improve KDL queries

This commit is contained in:
Amaan Qureshi 2023-02-05 21:28:27 -05:00 committed by Stephan Seitz
parent 24d5be6e71
commit c3a7dd4768
8 changed files with 30 additions and 5 deletions

View file

@ -249,7 +249,7 @@ We are looking for maintainers to add more parsers and to write query files for
- [x] [JSON with comments](https://gitlab.com/WhyNotHugo/tree-sitter-jsonc.git) (maintained by @WhyNotHugo)
- [x] [jsonnet](https://github.com/sourcegraph/tree-sitter-jsonnet) (maintained by @nawordar)
- [x] [julia](https://github.com/tree-sitter/tree-sitter-julia) (maintained by @theHamsta)
- [x] [kdl](https://github.com/amaanq/tree-sitter-kdl) (experimental, maintained by @amaanq)
- [x] [kdl](https://github.com/amaanq/tree-sitter-kdl) (maintained by @amaanq)
- [x] [kotlin](https://github.com/fwcd/tree-sitter-kotlin) (maintained by @SalBakraa)
- [x] [lalrpop](https://github.com/traxys/tree-sitter-lalrpop) (maintained by @traxys)
- [x] [latex](https://github.com/latex-lsp/tree-sitter-latex) (maintained by @theHamsta, @clason)

View file

@ -231,7 +231,7 @@
"revision": "e2f449e2bcc95f1d07ceb62d67f986005f73a6be"
},
"kdl": {
"revision": "f83f3943568c7e7b4f5e0de1b04d722223bd4d80"
"revision": "92fcc2fe21474f9f855617a6f705fe3cdb288bfe"
},
"kotlin": {
"revision": "e4637037a5fe6f25fe66c305669faa0855f35692"

View file

@ -757,7 +757,6 @@ list.kdl = {
files = { "src/parser.c", "src/scanner.c" },
},
maintainers = { "@amaanq" },
experimental = true,
}
list.kotlin = {

View file

@ -1,3 +1,8 @@
; Folds
(node_children) @fold
[
(node)
(node_children)
(string)
(multi_line_comment)
] @fold

View file

@ -48,7 +48,7 @@
[
(single_line_comment)
(multi_line_comment)
] @comment
] @comment @spell
(node (node_comment) (#set! "priority" 105)) @comment
(node (node_field (node_field_comment) (#set! "priority" 105)) @comment)

7
queries/kdl/indents.scm Normal file
View file

@ -0,0 +1,7 @@
(node (node_children) @indent)
"}" @indent_end
[ "{" "}" ] @branch
[ "(" ")" ] @branch

View file

@ -0,0 +1,4 @@
[
(single_line_comment)
(multi_line_comment)
] @comment

10
queries/kdl/locals.scm Normal file
View file

@ -0,0 +1,10 @@
(document) @scope
(node (node_children) @scope)
(node_children (node) @scope)
(identifier) @reference
(node_field) @definition.field
(node (identifier) @definition.type)
(type) @definition.type