Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sigils - IntelliLang Language Injection Support PoC #3671

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

polymorfiq
Copy link

@polymorfiq polymorfiq commented Dec 28, 2024

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 difficult

This 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 🤔

Screenshot 2024-12-27 at 11 16 11 PM

Notes:

Right now I have ~L pointed at EEx, though from my understanding it should be Heex or Leex

Ideally, ElixirSigilInjector is entirely un-needed or otherwise wouldn't specify languages (languageForSigil) - but without its existence, Intellij seemed to be using the markdown.Injector and thus ElixirSigilInjectionSupport was only being passed Heredoc elements. I could not get IntelliJ to ignore the org.elixir_lang.injection.markdown.Injector, so instead ElixirSigilInjectionSupport is currently overriding it as the default, for everything besides Heredocs.

The reason ElixirSigilInjector specifying languages should be unneeded, is that using the added sigilWithName pattern and elixirInjections.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 the ElixirSigilInjector seems to require):
Screenshot 2024-12-27 at 11 44 35 PM

Hope this helps! 🎉

@joshuataylor
Copy link
Collaborator

This is absolutely amazing, thank you for just diving in and getting dirty -- hope it wasn't too full of spiders!

Let me know if you need anything in future as well, I'd be happy to chat about any of this, especially as IntelliJ has been changing a lot of their Custom Language Support in the last year or so.

I'll review this ASAP. <3

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants