Skip to content

Commit

Permalink
Jinja language family syntax support (helix-editor#7233)
Browse files Browse the repository at this point in the history
* feat: add jinja language support

* feat: add nunjucks language support

* feat: add to lang support book jinja and nunjucks languages
  • Loading branch information
vanarok authored and Schuyler Mortimer committed Jul 10, 2024
1 parent d2a35b9 commit df353aa
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 0 deletions.
2 changes: 2 additions & 0 deletions book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
| ini || | | |
| java |||| `jdtls` |
| javascript |||| `typescript-language-server` |
| jinja || | | |
| jsdoc || | | |
| json || || `vscode-json-language-server` |
| jsonnet || | | `jsonnet-language-server` |
Expand Down Expand Up @@ -100,6 +101,7 @@
| nim |||| `nimlangserver` |
| nix || | | `nil` |
| nu || | | |
| nunjucks || | | |
| ocaml || || `ocamllsp` |
| ocaml-interface || | | `ocamllsp` |
| odin || || `ols` |
Expand Down
22 changes: 22 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2702,6 +2702,28 @@ roots = []
indent = { tab-width = 2, unit = " " }
grammar = "html"

[[language]]
name = "nunjucks"
scope = "text.html.nunjucks"
injection-regex = "nunjucks"
file-types = ["njk"]
roots = []
indent = { tab-width = 2, unit = " " }
grammar = "jinja2"

[[language]]
name = "jinja"
scope = "text.html.jinja"
injection-regex = "jinja"
file-types = ["jinja", "jinja2", "j2"]
roots = []
indent = { tab-width = 2, unit = " " }
grammar = "jinja2"

[[grammar]]
name = "jinja2"
source = { git = "https://github.com/varpeti/tree-sitter-jinja2", rev = "a533cd3c33aea6acb0f9bf9a56f35dcfe6a8eb53" }

[[grammar]]
name = "wren"
source = { git = "https://git.sr.ht/~jummit/tree-sitter-wren", rev = "793d58266924e6efcc40e411663393e9d72bec87"}
Expand Down
7 changes: 7 additions & 0 deletions runtime/queries/jinja/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
(expression) @string
(statement) @variable.builtin
(keyword) @keyword
(comment) @comment
(identifier) @variable.parameter
(operator) @operator
(string) @string
4 changes: 4 additions & 0 deletions runtime/queries/jinja/injections.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
((source_file) @injection.content
(#set! injection.combined)
(#set! injection.include-children)
(#set! injection.language "html"))
1 change: 1 addition & 0 deletions runtime/queries/nunjucks/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
; inherits: jinja
1 change: 1 addition & 0 deletions runtime/queries/nunjucks/injections.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
; inherits: jinja

0 comments on commit df353aa

Please sign in to comment.