mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-01 11:06:54 -04:00
Add HEEx language support, add missing commentstrings
This commit is contained in:
parent
807c3da669
commit
a9e32d0cc5
14 changed files with 87 additions and 7 deletions
1
after/ftplugin/elixir.vim
Normal file
1
after/ftplugin/elixir.vim
Normal file
|
|
@ -0,0 +1 @@
|
|||
setlocal commentstring=#\ %s
|
||||
1
after/ftplugin/heex.vim
Normal file
1
after/ftplugin/heex.vim
Normal file
|
|
@ -0,0 +1 @@
|
|||
setlocal commentstring=<%#\ %s\ %>
|
||||
1
after/ftplugin/surface.vim
Normal file
1
after/ftplugin/surface.vim
Normal file
|
|
@ -0,0 +1 @@
|
|||
setlocal commentstring={!--\ %s\ --}
|
||||
|
|
@ -1,2 +1,2 @@
|
|||
au BufRead,BufNewFile *.ex,*.exs,mix.lock set filetype=elixir
|
||||
au BufRead,BufNewFile *.eex,*.leex,*.heex set filetype=eelixir
|
||||
au BufRead,BufNewFile *.eex,*.leex set filetype=eelixir
|
||||
|
|
|
|||
1
ftdetect/heex.vim
Normal file
1
ftdetect/heex.vim
Normal file
|
|
@ -0,0 +1 @@
|
|||
au BufRead,BufNewFile *.heex set filetype=heex
|
||||
|
|
@ -271,6 +271,16 @@ list.surface = {
|
|||
maintainers = { "@connorlay" },
|
||||
}
|
||||
|
||||
list.heex = {
|
||||
install_info = {
|
||||
url = "https://github.com/connorlay/tree-sitter-heex",
|
||||
files = { "src/parser.c" },
|
||||
branch = "main",
|
||||
},
|
||||
filetype = "heex",
|
||||
maintainers = { "@connorlay" },
|
||||
}
|
||||
|
||||
list.ocaml = {
|
||||
install_info = {
|
||||
url = "https://github.com/tree-sitter/tree-sitter-ocaml",
|
||||
|
|
|
|||
|
|
@ -13,3 +13,8 @@
|
|||
(sigil_start) @_start
|
||||
(sigil_content) @surface)
|
||||
(#eq? @_start "~F\"\"\""))
|
||||
|
||||
((sigil
|
||||
(sigil_start) @_start
|
||||
(sigil_content) @heex)
|
||||
(#eq? @_start "~H\"\"\""))
|
||||
|
|
|
|||
5
queries/heex/folds.scm
Normal file
5
queries/heex/folds.scm
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
; HEEx folds similar to HTML
|
||||
[
|
||||
(tag)
|
||||
(component)
|
||||
] @fold
|
||||
35
queries/heex/highlights.scm
Normal file
35
queries/heex/highlights.scm
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
; HEEx text is highlighted as such
|
||||
(text) @text
|
||||
|
||||
; HEEx has two types of comments, both are highlighted as such
|
||||
(comment) @comment
|
||||
|
||||
; HEEx attributes are highlighted as HTML attributes
|
||||
(attribute_name) @tag.attribute
|
||||
|
||||
; Attributes are highlighted as strings
|
||||
(quoted_attribute_value) @string
|
||||
|
||||
; HEEx supports HTML tags and are highlighted as such
|
||||
[
|
||||
"<"
|
||||
">"
|
||||
"</"
|
||||
"/>"
|
||||
"<%"
|
||||
"<%="
|
||||
"<%%="
|
||||
"<%#"
|
||||
"%>"
|
||||
"{"
|
||||
"}"
|
||||
] @tag.delimiter
|
||||
|
||||
; HEEx tags are highlighted as HTML
|
||||
(tag_name) @tag
|
||||
|
||||
; HEEx components are highlighted as types (Elixir modules)
|
||||
(component_name) @type
|
||||
|
||||
; HEEx operators
|
||||
["="] @operator
|
||||
11
queries/heex/indents.scm
Normal file
11
queries/heex/indents.scm
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
; HEEx indents like HTML
|
||||
[
|
||||
(component)
|
||||
(tag)
|
||||
] @indent
|
||||
|
||||
; Dedent at the end of each tag
|
||||
[
|
||||
(end_tag)
|
||||
(end_component)
|
||||
] @branch
|
||||
7
queries/heex/injections.scm
Normal file
7
queries/heex/injections.scm
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
; Directives are combined to support do blocks
|
||||
(directive (expression_value) @elixir @combined)
|
||||
|
||||
; Expressions are not combined, as they exist separately from do blocks
|
||||
(expression (expression_value) @elixir)
|
||||
|
||||
(comment) @comment
|
||||
|
|
@ -1,5 +1,6 @@
|
|||
; Surface folds similar to HTML and includes blocks
|
||||
[
|
||||
(tag)
|
||||
(component)
|
||||
(block)
|
||||
] @fold
|
||||
|
|
|
|||
|
|
@ -19,12 +19,12 @@
|
|||
|
||||
; Surface supports HTML tags and are highlighted as such
|
||||
[
|
||||
(start_tag)
|
||||
(end_tag)
|
||||
(self_closing_tag)
|
||||
(start_component)
|
||||
(end_component)
|
||||
(self_closing_component)
|
||||
"<"
|
||||
">"
|
||||
"</"
|
||||
"/>"
|
||||
"{"
|
||||
"}"
|
||||
] @tag.delimiter
|
||||
|
||||
; Expressions are similar to string interpolation, and are highloghted as such
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
; Surface indents like HTML, with the addition of blocks
|
||||
[
|
||||
(component)
|
||||
(tag)
|
||||
(block)
|
||||
] @indent
|
||||
|
|
@ -7,6 +8,7 @@
|
|||
; Dedent at the end of each tag, as well as a subblock
|
||||
[
|
||||
(end_tag)
|
||||
(end_component)
|
||||
(end_block)
|
||||
(subblock)
|
||||
] @branch
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue