mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 19:17:02 -04:00
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:
parent
8546502163
commit
aad763de6b
5 changed files with 72 additions and 0 deletions
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -218,6 +218,9 @@
|
|||
"julia": {
|
||||
"revision": "9d368185be7e8139f2eda93d8b0acc2a54031718"
|
||||
},
|
||||
"kdl": {
|
||||
"revision": "3a67244a48e9446248fc48117afe11dab19b030a"
|
||||
},
|
||||
"kotlin": {
|
||||
"revision": "e4637037a5fe6f25fe66c305669faa0855f35692"
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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
3
queries/kdl/folds.scm
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
; Folds
|
||||
|
||||
(node_children) @fold
|
||||
55
queries/kdl/highlights.scm
Normal file
55
queries/kdl/highlights.scm
Normal 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
|
||||
Loading…
Add table
Add a link
Reference in a new issue