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

Heex support #557

Merged
merged 2 commits into from
Jan 26, 2022
Merged

Heex support #557

merged 2 commits into from
Jan 26, 2022

Conversation

joeesteves
Copy link
Contributor

@joeesteves joeesteves commented Nov 12, 2021

Add support for heex (single curly braces) <div id={@id}> , skip interpolation strings inside Heex expressions.
Address 👇 #555

Before:
image

After:
image

skip interpolation strings
@joeesteves joeesteves changed the title add single curly braces delimiters Heex support Nov 12, 2021
@joeesteves
Copy link
Contributor Author

Hi @jbodah, as u may notice I'm not a vim-script expert. Don't know if this is the correct approach for solving this, just wan't to share my workaround.

I'll be glad to help improving heex support. So any guidance from the community will be welcome

@sodapopcan
Copy link
Collaborator

Thanks for taking this on @ponyesteves—this has been driving me a little nuts!

The only comment I have on your PR is that you forgot to uncomment the guard clause (I'm not the owner of the repo, of course, I just follow it).

Also, just looking at your screenshot, did you know you can pass a list to the class attribute to avoid string interpolation? Maybe you do know and prefer the interpolation but couldn't keep myself from commenting just in case you didn't as I quite the list version :)

<div class={["list-item_group", "text-secondary", maybe_hidden_balance_class(balance)]}>

It's also nice because if maybe_hidden_balance_class returns nil and it's the only entry, class="" doesn't even get rendered (if you care about that kind of thing).

@joeesteves
Copy link
Contributor Author

The only comment I have on your PR is that you forgot to uncomment the guard clause (I'm not the owner of the repo, of course, I just follow it).

Hey @sodapopcan thanks for your suggestion, I've address it. It seems I missed on removing my trial and error comment. I was trying to find out how all this vim scripting works, so great catch.

TIL 👇

<div class={["list-item_group", "text-secondary", maybe_hidden_balance_class(balance)]}>

Great advice on using Lists to avoid String interpolation. I'm migrating some of my projects to phoenix 1.6 and I wasn't a Surface user, So this heex syntax is kind of new for me.

@Matsa59
Copy link

Matsa59 commented Jan 25, 2022

Any news ?

If you want to continue using this repo I add the following script to my init.vim (I'm on neovim) as a workaround

au BufEnter *.heex syn region  surfaceExpression matchgroup=surfaceDelimiter start="{" end="}" contains=@elixirTop  containedin=ALLBUT,@eelixirRegions keepend
au BufEnter *.heex syn region  surfaceExpression matchgroup=surfaceDelimiter start="{" end="}" skip="#{[^}]*}" contains=@elixirTop  containedin=htmlValue keepend

I just copy the changes from the PR
I don't know anything from vim script so I hope I did nothing wrong x)

@jbodah
Copy link
Collaborator

jbodah commented Jan 26, 2022

Hi all - thanks for the patches. I can merge however I do not intend to much more support for vim-elixir going forward as I have been far removed from Elixir for several years now. If anyone would like to take the maintenance reins then please let me know and I can coordinate with the Elixir team to have you added as a maintainer

@jbodah
Copy link
Collaborator

jbodah commented Jan 26, 2022

Was not able to get new unit tests for heex working on this, however tested manually and confirmed no regressions in existing suite

@jbodah jbodah merged commit ff7a122 into elixir-editors:master Jan 26, 2022
@joeesteves joeesteves deleted the improve-heex-support branch January 26, 2022 14:20
@joeesteves
Copy link
Contributor Author

Hi all - thanks for the patches. I can merge however I do not intend to much more support for vim-elixir going forward as I have been far removed from Elixir for several years now. If anyone would like to take the maintenance reins then please let me know and I can coordinate with the Elixir team to have you added as a maintainer

@jbodah Thanks for merging this.

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.

4 participants