mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-18 19:30:02 -04:00
Upgrade to HEEx parser 0.3.0
This commit is contained in:
parent
c7d5ba7212
commit
9e90866bce
4 changed files with 51 additions and 22 deletions
|
|
@ -1,16 +1,13 @@
|
||||||
(text) @text
|
; HEEx tag and component delimiters
|
||||||
(comment) @comment
|
|
||||||
(doctype) @constant
|
|
||||||
|
|
||||||
; HEEx attributes are highlighted as HTML attributes
|
|
||||||
(attribute_name) @tag.attribute
|
|
||||||
(quoted_attribute_value) @string
|
|
||||||
|
|
||||||
[
|
[
|
||||||
"%>"
|
"%>"
|
||||||
|
"--%>"
|
||||||
|
"-->"
|
||||||
"/>"
|
"/>"
|
||||||
"<!"
|
"<!"
|
||||||
|
"<!--"
|
||||||
"<"
|
"<"
|
||||||
|
"<%!--"
|
||||||
"<%"
|
"<%"
|
||||||
"<%#"
|
"<%#"
|
||||||
"<%%="
|
"<%%="
|
||||||
|
|
@ -21,13 +18,34 @@
|
||||||
"}"
|
"}"
|
||||||
] @tag.delimiter
|
] @tag.delimiter
|
||||||
|
|
||||||
[
|
; HEEx operators
|
||||||
"="
|
"=" @operator
|
||||||
] @operator
|
|
||||||
|
|
||||||
; HEEx tags are highlighted as HTML
|
; HEEx inherits the DOCTYPE tag from HTML
|
||||||
|
(doctype) @constant
|
||||||
|
|
||||||
|
; HEEx tags are highlighted as HTML tags
|
||||||
(tag_name) @tag
|
(tag_name) @tag
|
||||||
|
|
||||||
; HEEx components are highlighted as types (Elixir modules)
|
; HEEx comments are highlighted as such
|
||||||
(component_name) @type
|
(comment) @comment
|
||||||
|
|
||||||
|
; HEEx text content is treated as markup
|
||||||
|
(text) @text
|
||||||
|
|
||||||
|
; Tree-sitter parser errors
|
||||||
|
(ERROR) @error
|
||||||
|
|
||||||
|
; HEEx attributes are highlighted as HTML attributes
|
||||||
|
(attribute_name) @tag.attribute
|
||||||
|
[
|
||||||
|
(attribute_value)
|
||||||
|
(quoted_attribute_value)
|
||||||
|
] @string
|
||||||
|
|
||||||
|
; HEEx components are highlighted as modules and function calls
|
||||||
|
(component_name [
|
||||||
|
(module) @type
|
||||||
|
(function) @function
|
||||||
|
"." @punctuation.delimiter
|
||||||
|
])
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
; HEEx indents like HTML
|
; HEEx indents like HTML
|
||||||
[
|
[
|
||||||
(component)
|
(component)
|
||||||
(tag)
|
(tag)
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
; TODO: once @combined is fixed for all modules, replace this with the two queries below
|
; HEEx directives can span multiple interpolated lines of Elixir
|
||||||
(expression_value) @elixir
|
(directive [
|
||||||
|
(expression_value)
|
||||||
|
(partial_expression_value)
|
||||||
|
] @elixir @combined)
|
||||||
|
|
||||||
; Directives are combined to support do blocks
|
; HEEx Elixir expressions are always within a tag or component
|
||||||
; (directive (expression_value) @elixir @combined)
|
(expression (expression_value) @elixir)
|
||||||
|
|
||||||
; Expressions are not combined, as they exist separately from do blocks
|
|
||||||
; (expression (expression_value) @elixir)
|
|
||||||
|
|
||||||
(comment) @comment
|
(comment) @comment
|
||||||
|
|
|
||||||
11
queries/heex/locals.scm
Normal file
11
queries/heex/locals.scm
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
; HEEx tags and components are references
|
||||||
|
[
|
||||||
|
(tag_name)
|
||||||
|
(component_name)
|
||||||
|
] @reference
|
||||||
|
|
||||||
|
; Create a new scope within each HEEx tag or component
|
||||||
|
[
|
||||||
|
(tag)
|
||||||
|
(component)
|
||||||
|
] @scope
|
||||||
Loading…
Add table
Add a link
Reference in a new issue