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

Autoindent not working correctly for <.dot> style HTML tags/components in eelixir #559

Open
TheArrowsmith opened this issue Jan 8, 2022 · 4 comments

Comments

@TheArrowsmith
Copy link

The title more or less says it all. When I'm editing a file where filetype=eelixir, e.g. .eex or .heex file, then autoindentation
works correctly if, say, I add an if statement:

# I type this line:
<%= if condition do %>

# Still in insert mode, I hit Enter, and two spaces are added, with the cursor ending up at the X:
<%= if condition do %>
  X

But if I try to add a "dot" tag - not sure of the correct terminology, I'm talking about tags that call an Elixir function and start with <. - then the autoindent doesn't work:

# After typing the first line and hitting Return, no new indentation is added and the cursor is at X:
<.form {some_attributes}>
X

Is there a way to fix this?

@ghost
Copy link

ghost commented Oct 13, 2023

@TheArrowsmith , couldn't find any tag that resembles such syntax in the EEx documentation: EEx/tags.

Is this from a previous version?

@TheArrowsmith
Copy link
Author

No, it's from the current version of HEEx, and was added in LiveView 0.18 I think.

https://hexdocs.pm/phoenix/components.html

https://hexdocs.pm/phoenix_live_view/assigns-eex.html

@ghost
Copy link

ghost commented Oct 13, 2023

@TheArrowsmith , thanks for your response.

I'm interested in contributing to the project but I'm still familiarizing myself with the codebase and Elixir itself 😅.

As for now, I can only offer you a hacky work-around, it would involve adding the following to your runtime path in an after directory (i.e. after/ftplugin/heex.vim):

syn region eelixirExpression matchgroup=eelixirDelimiter start="<."  end="/>" contains=@elixirTop  containedin=ALLBUT,@eelixirRegions keepend

Hope it helps, although there's a high possibilty that it may not work as expected, so please let me know 🙂 .

@jbodah
Copy link
Collaborator

jbodah commented Oct 13, 2023

@samanera Please let me know if I can help you get acquainted at all. I’m on the official Elixir Discord if you’d like to get in touch. I’ve been fairly absent from this project as I haven’t used Elixir in many years, but I have a pretty good understanding of most of the project and would like to support any motivated contributors

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

No branches or pull requests

2 participants