Improve embedded HEEx and Surface syntax highlighting #570
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Currently, embedded HEEx is simply highlighted as HTML. This breaks as soon as you have lines like
:for={i <- @numbers}
or:if={a > 2}
where the<
and>
are treated as HTML. There are also other random things like{[
that completely break highlighting. I've been just silently dealing with this for four years now and figured I'd fix it anyway I could!I saw the problem was mainly that you end up with a recursion error when you have
syntax/elixir.vim
callingsyn import @EELIXIR syntax/eelixir.vim
andsyntax/eelixir.vim
callingsyn import @elixirTop syntax/elixir.vim
. After trying trying to hack around this, I figured duplication was the best answer and it's worked quite nicely.This PR does this following:
phx-
attributessome_attr="some value"
):if
,:for
, and:let
)I have not copied this stuff over to
syntax/eelixir.vim
as I wanted a review first. I can certainly roll back any of the breaking change stuff, but I don't know how many Elixirists still use vanilla Vim.Thanks!
Closes #566