Add tree-sitter injections for jj config files (#13926)

default-inline-diagnostics
Bryce Berger 2025-07-16 09:36:54 -04:00 committed by GitHub
parent ab668c2dfc
commit 3658e97c2b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
8 changed files with 76 additions and 0 deletions

View File

@ -117,7 +117,10 @@
| java | ✓ | ✓ | ✓ | `jdtls` |
| javascript | ✓ | ✓ | ✓ | `typescript-language-server` |
| jinja | ✓ | | | |
| jjconfig | ✓ | ✓ | ✓ | `taplo`, `tombi` |
| jjdescription | ✓ | | | |
| jjrevset | ✓ | | | |
| jjtemplate | ✓ | | | |
| jq | ✓ | ✓ | | `jq-lsp` |
| jsdoc | ✓ | | | |
| json | ✓ | ✓ | ✓ | `vscode-json-language-server` |

View File

@ -3541,6 +3541,16 @@ block-comment-tokens = { start = "{#", end = "#}" }
name = "jinja2"
source = { git = "https://github.com/varpeti/tree-sitter-jinja2", rev = "a533cd3c33aea6acb0f9bf9a56f35dcfe6a8eb53" }
[[language]]
name = "jjconfig"
scope = "source.jjconfig"
injection-regex = "jjconfig"
grammar = "toml"
file-types = [{ glob = "jj/config.toml" }, { glob = "jj/conf.d/*.toml" }, { glob = ".jj/repo/*.toml" }]
comment-token = "#"
language-servers = [ "taplo", "tombi" ]
indent = { tab-width = 2, unit = " " }
[[language]]
name = "jjdescription"
scope = "jj.description"
@ -3554,6 +3564,24 @@ text-width = 72
name = "jjdescription"
source = { git = "https://github.com/kareigu/tree-sitter-jjdescription", rev = "1613b8c85b6ead48464d73668f39910dcbb41911" }
[[language]]
name = "jjrevset"
scope = "jj.revset"
file-types = ["jjrevset"]
[[grammar]]
name = "jjrevset"
source = { git = "https://github.com/bryceberger/tree-sitter-jjrevset", rev = "d9af23944b884ec528b505f41d81923bb3136a51" }
[[language]]
name = "jjtemplate"
scope = "jj.template"
file-types = ["jjtemplate"]
[[grammar]]
name = "jjtemplate"
source = { git = "https://github.com/bryceberger/tree-sitter-jjtemplate", rev = "4313eda8ac31c60e550e3ad5841b100a0a686715" }
[[language]]
name = "jq"
scope = "source.jq"

View File

@ -0,0 +1 @@
; inherits: toml

View File

@ -0,0 +1 @@
; inherits: toml

View File

@ -0,0 +1,10 @@
((comment) @injection.content
(#set! injection.language "comment"))
(table
(bare_key) @table-name (#any-of? @table-name "templates" "template-aliases")
[(pair (_) ((string) @injection.content (#set! injection.language "jjtemplate"))) (comment)]*)
(table
(bare_key) @table-name (#any-of? @table-name "revsets" "revset-aliases")
[(pair (_) ((string) @injection.content (#set! injection.language "jjrevset"))) (comment)]*)

View File

@ -0,0 +1 @@
; inherits: toml

View File

@ -0,0 +1,18 @@
(at_op) @variable.builtin
[
"::" ".."
(negate_op)
(union_op) (intersection_op) (difference_op)
] @operator
["(" ")"] @punctuation.bracket
"," @punctuation.delimiter
[(raw_string_literal) (string_literal)] @string
(function ((strict_identifier) @function))
(function (function_arguments (keyword_argument (strict_identifier) @variable.parameter)))
(primary ((identifier) @variable))
(string_pattern (strict_identifier) @keyword)

View File

@ -0,0 +1,14 @@
(function ((identifier) @function))
; method calls
(term (_) ("." @punctuation) ((function ((identifier) @function.method))))
["(" ")"] @punctuation.bracket
"," @punctuation.delimiter
((identifier) @keyword.control.conditional (#eq? @keyword.control.conditional "if"))
((identifier) @keyword.control.repeat (#eq? @keyword.control.repeat "for"))
(term ((identifier) @variable))
[(infix_ops) "++"] @operator
[(string_literal) (raw_string_literal)] @string