Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

Fix issues with syntax highlighting in elixir and heex

Max Brunsfeld04430fdbd628
diff --git a/crates/zed/src/languages/elixir/highlights.scm b/crates/zed/src/languages/elixir/highlights.scm
index deea51c4363..0e779d195c5 100644
--- a/crates/zed/src/languages/elixir/highlights.scm
+++ b/crates/zed/src/languages/elixir/highlights.scm
@@ -36,8 +36,6 @@
(char) @constant
-(interpolation "#{" @punctuation.special "}" @punctuation.special) @embedded
-
(escape_sequence) @string.escape
[
@@ -146,3 +144,10 @@
"<<"
">>"
] @punctuation.bracket
+
+(interpolation "#{" @punctuation.special "}" @punctuation.special) @embedded
+
+((sigil
+ (sigil_name) @_sigil_name
+ (quoted_content) @embedded)
+ (#eq? @_sigil_name "H"))
diff --git a/crates/zed/src/languages/heex/highlights.scm b/crates/zed/src/languages/heex/highlights.scm
index fa88acd4d99..8728110d582 100644
--- a/crates/zed/src/languages/heex/highlights.scm
+++ b/crates/zed/src/languages/heex/highlights.scm
@@ -1,17 +1,11 @@
; HEEx delimiters
[
- "%>"
"--%>"
"-->"
"/>"
"<!"
"<!--"
"<"
- "<%!--"
- "<%"
- "<%#"
- "<%%="
- "<%="
"</"
"</:"
"<:"
@@ -20,6 +14,15 @@
"}"
] @punctuation.bracket
+[
+ "<%!--"
+ "<%"
+ "<%#"
+ "<%%="
+ "<%="
+ "%>"
+] @keyword
+
; HEEx operators are highlighted as such
"=" @operator
diff --git a/crates/zed/src/languages/heex/injections.scm b/crates/zed/src/languages/heex/injections.scm
index 0d4977b28a4..41b65db8eed 100644
--- a/crates/zed/src/languages/heex/injections.scm
+++ b/crates/zed/src/languages/heex/injections.scm
@@ -1,11 +1,13 @@
-((directive (partial_expression_value) @content)
- (#set! language "elixir")
- (#set! include-children)
- (#set! combined))
-
-; Regular expression_values do not need to be combined
-((directive (expression_value) @content)
- (#set! language "elixir"))
+(
+ (directive
+ [
+ (partial_expression_value)
+ (expression_value)
+ (ending_expression_value)
+ ] @content)
+ (#set! language "elixir")
+ (#set! combined)
+)
; expressions live within HTML tags, and do not need to be combined
; <link href={ Routes.static_path(..) } />