elixir-editors / emacs-elixir

Emacs major mode for Elixir
446 stars 94 forks source link

Sigil heredoc support #468

Closed J3RN closed 3 years ago

J3RN commented 3 years ago

The syntax highlighting for LiveView with heredocs is broken: image

This (single character) change make the ~L sigil support heredocs: image

Ideally I would like to apply the interpolation face inside of <% ... %>, but I'm not really sure how to approach that and this change stands on its own.

J3RN commented 3 years ago

I just realized that triple quotes are valid for all sigils, so a "true fix" might require a different change.

iex(1)> ~c"""
...(1)> foo bar  
...(1)> """
'foo bar\n'
iex(2)> ~r"""
...(2)> foo bar 
...(2)> """
~r/foo bar\n/
iex(3)> ~W"""
...(3)> foo bar
...(3)> """
["foo", "bar"]
iex(4)> 
axelson commented 3 years ago

Could you add the full list of supported sigils from: https://github.com/elixir-editors/emacs-elixir/pull/454/files

It won't be perfect but I think it would be good enough for now.

J3RN commented 3 years ago

@axelson Done! :grin: