Skip to content

Commit

Permalink
add tree-sitter-eex
Browse files Browse the repository at this point in the history
EEx is an templating language for Elixir. Since the incremental
parsing refactor we can used combined injections which allows us
to add EEx support.
  • Loading branch information
the-mikedavis authored and archseer committed Apr 13, 2022
1 parent 4ac94a5 commit 9d095e0
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
1 change: 1 addition & 0 deletions book/src/generated/lang-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
| css || | | `vscode-css-language-server` |
| dart || || `dart` |
| dockerfile || | | `docker-langserver` |
| eex || | | |
| ejs || | | |
| elixir || | | `elixir-ls` |
| elm || | | `elm-language-server` |
Expand Down
12 changes: 12 additions & 0 deletions languages.toml
Original file line number Diff line number Diff line change
Expand Up @@ -1113,3 +1113,15 @@ grammar = "embedded-template"
[[grammar]]
name = "embedded-template"
source = { git = "https://github.com/tree-sitter/tree-sitter-embedded-template", rev = "d21df11b0ecc6fd211dbe11278e92ef67bd17e97" }

[[language]]
name = "eex"
scope = "source.eex"
injection-regex = "eex"
file-types = ["eex"]
roots = []
indent = { tab-width = 2, unit = " " }

[[grammar]]
name = "eex"
source = { git = "https://github.com/connorlay/tree-sitter-eex", rev = "f742f2fe327463335e8671a87c0b9b396905d1d1" }
6 changes: 6 additions & 0 deletions runtime/queries/eex/highlights.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
; https://github.com/connorlay/tree-sitter-eex/blob/f742f2fe327463335e8671a87c0b9b396905d1d1/queries/highlights.scm

; wrapping in (directive .. ) prevents us from highlighting '%>' in a comment as a keyword
(directive ["<%" "<%=" "<%%" "<%%=" "%>"] @keyword)

(comment) @comment
9 changes: 9 additions & 0 deletions runtime/queries/eex/injections.scm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
; https://github.com/connorlay/tree-sitter-eex/blob/f742f2fe327463335e8671a87c0b9b396905d1d1/queries/injections.scm

((directive (expression) @injection.content)
(#set! injection.language "elixir"))

((partial_expression) @injection.content
(#set! injection.language "elixir")
(#set! injection.include-children)
(#set! injection.combined))

0 comments on commit 9d095e0

Please sign in to comment.