intellij-elixir icon indicating copy to clipboard operation
intellij-elixir copied to clipboard

Support HEEx and ~H sigil.

Open odk211 opened this issue 4 years ago • 34 comments

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

odk211 avatar Sep 23 '21 05:09 odk211

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

mike1o1 avatar Sep 27 '21 03:09 mike1o1

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>

kurtome avatar Oct 29 '21 22:10 kurtome

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

benkeil avatar Feb 07 '22 07:02 benkeil

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

user1007017 avatar Mar 19 '22 09:03 user1007017

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!

codylandry avatar May 09 '22 21:05 codylandry

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.

KronicDeth avatar May 09 '22 22:05 KronicDeth

@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 😂

kurtome avatar May 10 '22 01:05 kurtome

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

odk211 avatar May 10 '22 01:05 odk211

Looking forward to seeing this! (@suretec)

ghenry avatar May 25 '22 21:05 ghenry

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

KronicDeth avatar Jun 20 '22 13:06 KronicDeth

I would love this!

knoebber avatar Jul 30 '22 15:07 knoebber

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

guessthepw avatar Oct 16 '22 02:10 guessthepw

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

MichaelHipp avatar Nov 10 '22 12:11 MichaelHipp

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.

kurtome avatar Dec 23 '22 18:12 kurtome

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

bopm avatar Mar 26 '23 16:03 bopm

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.

KronicDeth avatar Mar 26 '23 16:03 KronicDeth

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

bopm avatar Mar 26 '23 16:03 bopm

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 =-)

StragaSevera avatar Jun 20 '23 10:06 StragaSevera

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?

thacoon avatar Oct 22 '23 15:10 thacoon

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.

Trevoke avatar Nov 18 '23 18:11 Trevoke

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 👍

Ridtt avatar Dec 11 '23 11:12 Ridtt

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. 🙏

trashhalo avatar Jan 16 '24 15:01 trashhalo