Fix issues with syntax highlighting in elixir and heex (#2629)

Fixes
https://linear.app/zed-industries/issue/Z-2391/text-within-h-isnt-highlighted-the-same-as-in-heex-files
Fixes
https://linear.app/zed-industries/issue/Z-2415/syntax-highlighting-bug-in-strings

Release Notes:

- Fixed some issues with syntax highlighting in Elixir and Heex.

If the release notes are only intended for a specific release channel
only, add `(<release_channel>-only)` to the end of the release note
line.
These will be removed by the person making the release.
This commit is contained in:
Max Brunsfeld 2023-06-19 12:56:09 -07:00 committed by GitHub
commit 05d69c804c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 26 additions and 16 deletions

View file

@ -36,8 +36,6 @@
(char) @constant (char) @constant
(interpolation "#{" @punctuation.special "}" @punctuation.special) @embedded
(escape_sequence) @string.escape (escape_sequence) @string.escape
[ [
@ -146,3 +144,10 @@
"<<" "<<"
">>" ">>"
] @punctuation.bracket ] @punctuation.bracket
(interpolation "#{" @punctuation.special "}" @punctuation.special) @embedded
((sigil
(sigil_name) @_sigil_name
(quoted_content) @embedded)
(#eq? @_sigil_name "H"))

View file

@ -1,17 +1,11 @@
; HEEx delimiters ; HEEx delimiters
[ [
"%>"
"--%>" "--%>"
"-->" "-->"
"/>" "/>"
"<!" "<!"
"<!--" "<!--"
"<" "<"
"<%!--"
"<%"
"<%#"
"<%%="
"<%="
"</" "</"
"</:" "</:"
"<:" "<:"
@ -20,6 +14,15 @@
"}" "}"
] @punctuation.bracket ] @punctuation.bracket
[
"<%!--"
"<%"
"<%#"
"<%%="
"<%="
"%>"
] @keyword
; HEEx operators are highlighted as such ; HEEx operators are highlighted as such
"=" @operator "=" @operator

View file

@ -1,11 +1,13 @@
((directive (partial_expression_value) @content) (
(#set! language "elixir") (directive
(#set! include-children) [
(#set! combined)) (partial_expression_value)
(expression_value)
; Regular expression_values do not need to be combined (ending_expression_value)
((directive (expression_value) @content) ] @content)
(#set! language "elixir")) (#set! language "elixir")
(#set! combined)
)
; expressions live within HTML tags, and do not need to be combined ; expressions live within HTML tags, and do not need to be combined
; <link href={ Routes.static_path(..) } /> ; <link href={ Routes.static_path(..) } />