feat: add kdl (#4227)

* feat: add kdl

* feat: comment queries

* fix(kdl): comments properly highlighted now

* feat(kdl): folds

* chore: bump revision to feature-complete parser

* fix: folds
This commit is contained in:
Amaan Qureshi 2023-01-28 07:59:56 -05:00 committed by GitHub
parent 8546502163
commit aad763de6b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 72 additions and 0 deletions

View file

@ -245,6 +245,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] [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

@ -218,6 +218,9 @@
"julia": {
"revision": "9d368185be7e8139f2eda93d8b0acc2a54031718"
},
"kdl": {
"revision": "3a67244a48e9446248fc48117afe11dab19b030a"
},
"kotlin": {
"revision": "e4637037a5fe6f25fe66c305669faa0855f35692"
},

View file

@ -374,6 +374,16 @@ list.java = {
maintainers = { "@p00f" },
}
list.kdl = {
install_info = {
url = "https://github.com/amaanq/tree-sitter-kdl",
branch = "master",
files = { "src/parser.c", "src/scanner.c" },
},
maintainers = { "@amaanq" },
experimental = true,
}
list.kotlin = {
install_info = {
url = "https://github.com/fwcd/tree-sitter-kotlin",

3
queries/kdl/folds.scm Normal file
View file

@ -0,0 +1,3 @@
; Folds
(node_children) @fold

View file

@ -0,0 +1,55 @@
; Types
(node (identifier) @type)
(type) @type
(annotation_type) @type.builtin
; Properties
(prop (identifier) @property)
; Variables
(identifier) @variable
; Operators
[
"="
"+"
"-"
] @operator
; Literals
(string) @string
(escape) @string.escape
(number) @number
(number (decimal) @float)
(number (exponent) @float)
(number (decimal) (exponent) @float)
(boolean) @boolean
; Misc
"null" @constant.builtin
["{" "}"] @punctuation.bracket
["(" ")"] @punctuation.bracket
; Comments
[
(single_line_comment)
(multi_line_comment)
] @comment
(node (node_comment) (#set! "priority" 105)) @comment
(node (node_field (node_field_comment) (#set! "priority" 105)) @comment)
(node_children (node_children_comment) (#set! "priority" 105)) @comment