on master help sign in
Jinja language family syntax support (#7233)

* feat: add jinja language support * feat: add nunjucks language support * feat: add to lang support book jinja and nunjucks languages

commit57f093d83641642ad5d4ba42ae59f03272efcfcc authorIvan Isekeev <ivanisekeev0@gmail.com> dateWed 9 Aug 2023, 20:26 (3 years ago) parentc0eae84
6 files changed+37
book/src/generated/lang-support.md+2 languages.toml+22 runtime/queries/jinja/highlights.scm+7 runtime/queries/jinja/injections.scm+4 runtime/queries/nunjucks/highlights.scm+1 runtime/queries/nunjucks/injections.scm+1
book/src/generated/lang-support.md+2
@@ -71,6 +71,7 @@
7171| ini | ✓ | | | |
7272| java | ✓ | ✓ | ✓ | `jdtls` |
7373| javascript | ✓ | ✓ | ✓ | `typescript-language-server` |
74+| jinja | ✓ | | | |
7475| jsdoc | ✓ | | | |
7576| json | ✓ | | ✓ | `vscode-json-language-server` |
7677| jsonnet | ✓ | | | `jsonnet-language-server` |
@@ -100,6 +101,7 @@
100101| nim | ✓ | ✓ | ✓ | `nimlangserver` |
101102| nix | ✓ | | | `nil` |
102103| nu | ✓ | | | |
104+| nunjucks | ✓ | | | |
103105| ocaml | ✓ | | ✓ | `ocamllsp` |
104106| ocaml-interface | ✓ | | | `ocamllsp` |
105107| odin | ✓ | | ✓ | `ols` |
languages.toml+22
@@ -2702,6 +2702,28 @@ roots = []
27022702indent = { tab-width = 2, unit = " " }
27032703grammar = "html"
27042704
2705+[[language]]
2706+name = "nunjucks"
2707+scope = "text.html.nunjucks"
2708+injection-regex = "nunjucks"
2709+file-types = ["njk"]
2710+roots = []
2711+indent = { tab-width = 2, unit = " " }
2712+grammar = "jinja2"
2713+
2714+[[language]]
2715+name = "jinja"
2716+scope = "text.html.jinja"
2717+injection-regex = "jinja"
2718+file-types = ["jinja", "jinja2", "j2"]
2719+roots = []
2720+indent = { tab-width = 2, unit = " " }
2721+grammar = "jinja2"
2722+
2723+[[grammar]]
2724+name = "jinja2"
2725+source = { git = "https://github.com/varpeti/tree-sitter-jinja2", rev = "a533cd3c33aea6acb0f9bf9a56f35dcfe6a8eb53" }
2726+
27052727[[grammar]]
27062728name = "wren"
27072729source = { git = "https://git.sr.ht/~jummit/tree-sitter-wren", rev = "793d58266924e6efcc40e411663393e9d72bec87"}
runtime/queries/jinja/highlights.scmnew file+7
@@ -0,0 +1,7 @@
1+(expression) @string
2+(statement) @variable.builtin
3+(keyword) @keyword
4+(comment) @comment
5+(identifier) @variable.parameter
6+(operator) @operator
7+(string) @string
runtime/queries/jinja/injections.scmnew file+4
@@ -0,0 +1,4 @@
1+((source_file) @injection.content
2+ (#set! injection.combined)
3+ (#set! injection.include-children)
4+ (#set! injection.language "html"))
runtime/queries/nunjucks/highlights.scmnew file+1
@@ -0,0 +1 @@
1+; inherits: jinja
runtime/queries/nunjucks/injections.scmnew file+1
@@ -0,0 +1 @@
1+; inherits: jinja