Sigils - IntelliLang Language Injection Support PoC #3671
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.
First I wanted to say, great plugin! Thanks so much for maintaining it!
I do not know Java, Kotlin, IntelliJ Plugin development or really any of the associated tooling - so this is definitely just an example to potentially help development of features related to #695 and #2102
I have been recently using Phoenix LiveView extensively, and the lack of Language Injection and Syntax Highlighting for the
~H
and~L
sigils makes that a little difficultThis PR seems to get Language Injection working for the two sigils, though I have not figured out how to get the HTML syntax highlighting working alongside it. Since IntelliJ knows it's HTML, I'm not entirely sure why it doesn't respect the syntax highlighting of that language 🤔
Notes:
Right now I have
~L
pointed atEEx
, though from my understanding it should beHeex
orLeex
Ideally,
ElixirSigilInjector
is entirely un-needed or otherwise wouldn't specify languages (languageForSigil
) - but without its existence, Intellij seemed to be using themarkdown.Injector
and thusElixirSigilInjectionSupport
was only being passed Heredoc elements. I could not get IntelliJ to ignore theorg.elixir_lang.injection.markdown.Injector
, so insteadElixirSigilInjectionSupport
is currently overriding it as the default, for everything besides Heredocs.The reason
ElixirSigilInjector
specifying languages should be unneeded, is that using the addedsigilWithName
pattern andelixirInjections.xml
file, allows the user to override/attach arbitrary languages to arbitrary sigils, which is likely better than hardcoding which sigils should go to what language (like theElixirSigilInjector
seems to require):Hope this helps! 🎉