KronicDeth / intellij-elixir

Elixir plugin for JetBrain's IntelliJ Platform (including Rubymine)
Other
1.8k stars 152 forks source link

Support HEEx and ~H sigil. #2102

Open odk211 opened 2 years ago

odk211 commented 2 years ago

Phoenix Framework introduce HEEx new template engine. https://github.com/phoenixframework/phoenix_live_view/blob/master/CHANGELOG.md#new-html-engine

It's really great that intellij elixir support it! Currently it is a String.

スクリーンショット 2021-09-23 14 16 52
mike1o1 commented 2 years ago

I've had good luck by associating heex files as Embedded Elixir.

Preferences -> Editor -> File Types, then find "Embedded Elixir file", clicking "+" and adding *.heex.

image

kurtome commented 2 years ago

I've had good luck by associating heex files as Embedded Elixir.

This works alright, but doesn't help with the new attribute syntax:

<script defer phx-track-static type="text/javascript" src={Routes.static_path(@conn, "/assets/app.js")}></script>
benkeil commented 2 years ago

Do you have autocompletion for HTML, JavaScript or Tailwind in *.heex files?

user1007017 commented 2 years ago

Do you have autocompletion for HTML, JavaScript or Tailwind in *.heex files?

I managed to activate autocompletion for *.html.heex files altough it doesn't recocgnize the elixir code in it

grafik

codylandry commented 2 years ago

Just giving this a friendly bump. Syntax highlighing works in *.(h|l)eex files, but not in ~H, ~L strings. I think the IDE is not interpreting these as strings since using # language=html does not work either. Not saying they should, just an observation.

Example:

Screen Shot 2022-05-09 at 5 09 02 PM

I'd love to help, but I don't know java or how to write parsers, though I'm reading up on it now!

KronicDeth commented 2 years ago

I'm finally on a client project that uses HEEx, so I have good test sources.

I can not emphasize enough that if y'all would just let me sign NDAs to access your actual code I could development features a lot faster as I need example projects to continually develop against.

kurtome commented 2 years ago

@KronicDeth , I just made this repo public if it helps: https://github.com/kurtome/tefla

It's a side project that I'm probably never going to do anything with 😂

odk211 commented 2 years ago

Example code is https://github.com/livebook-dev/livebook. It uses HEEx a lot.

ghenry commented 2 years ago

Looking forward to seeing this! (@suretec)

KronicDeth commented 2 years ago

From Yann Cébron on JetBrains Platform Slack:

this is HTML based template language?

https://plugins.jetbrains.com/docs/intellij/api-notable-list-2020.html#intellij-platform-20203 Extensible HTML Lexer/Parser

https://blog.jetbrains.com/webstorm/2022/03/building-a-plugin-for-webstorm-part-3/ might be related AFAIU

or angular2 as reference https://github.com/JetBrains/intellij-plugins

knoebber commented 1 year ago

I would love this!

guessthepw commented 1 year ago

Any update on getting ~H syntax highlighting working? Only thing stopping me from making the switch from vscode.

MichaelHipp commented 1 year ago

Would really like to see a full set of features to support development in Phoenix LiveView.

kurtome commented 1 year ago

I wonder if anyone on the Phoenix core team would help with this, I know they have invested a lot in heex tooling and incorporating it in the the core formatter etc. cc @chrismccord

I think generally the IntelliJ ecosystem for Elixir/Phoenix isn't as well supported as VSCode which is too bad since IntelliJ is such a great IDE.

bopm commented 1 year ago

@KronicDeth can we get any update on this issue? Do you need help? Do you have plans for this one? Any roadmap?

KronicDeth commented 1 year ago

I’m working on 14.0.1 which is a bug fixes only release. Yes, help is always appreciated. There is no roadmap for anything ever. I work on the plugin as I have free time on DockYard Fridays.

bopm commented 1 year ago

Jfyi I sent this message to Brian Cardarella because I know how not having enough time for a project can affect things.

StragaSevera commented 1 year ago

Sadly, the highlighting does not work correctly even in the *.heex-files - when I set up the extension as an Embedded Elixir File with the template data language being HTML, I receive:

It would be a great step to just being able to use *.heex files =-)

thacoon commented 8 months ago

Having the same issue as @StragaSevera, see (app.html.heex) and using IntelliJ IDEA Ultimate on ArchLinux: Screenshot from 2023-10-22 17-56-17

I configured my file type associations as suggested: Screenshot from 2023-10-22 17-36-27

Does anyone has found a fix or workaround for this?

Trevoke commented 7 months ago

I'm going to add a friendly request here to the universe so that it decides to inspire you to work on this on an upcoming DockYard Friday.

Ridtt commented 6 months ago

I've learned to get along with all the weaknesses of the plugin for over 1 year now and find it quite handy. Now I want to try liveview and I really need these highlighting features 👍

trashhalo commented 5 months ago

I was thinking a good place to start to figure out how to do mixed syntax highlighting would be to find an open source plugin that already solved this problem for their parser and copy paste tweak your way to victory.

The mdx plugin has already solved this since mdx is a mixture of javascript and markdown syntax trees. Digging around their codebase I find the hook into detecting jsx content here https://github.com/JetBrains/intellij-plugins/blob/a9713ee928bc5df60bdc39ead79557b552a61d9a/mdx/src/main/kotlin/org/intellij/plugin/mdx/lang/parse/MdxHighlightingLexerBase.kt#L62

And you can see from the plugin page https://plugins.jetbrains.com/plugin/14944-mdx that syntax highlighting is indeed working in the javascript section. image

I dont know enough about intellij or java/kotlin to solve this but I hope this hint gives someone a good starting place. 🙏

JensvandeWiel commented 1 month ago

I have some background in intellij plugins, nut much but ill take a look at this.

trashhalo commented 3 weeks ago

Should we consider setting up a bounty system for this plugin? Jetbrains doesn't want to maintain this and some of us have access to discretionary spending at our jobs.

ghenry commented 3 weeks ago

I haven't had it working for a while now and need it for work, so yes please.