sodapopcan

sodapopcan

Vim users - Request for feedback on embedded template indentation

Hello fellow Vimmers!

I don’t know how many of you are out there since it’s my impression that this community seems to rally around VSCode (which is totally cool).

I’ve just opened up a PR in vim-elixir which makes some strides in fixing the indentation problem in LiveView and Surface inline templates. I’m looking for folks who would be willing to try it out for the next week or so and report any bugs/requests to me. Code-reviews would be welcome too!

Here’s the PR:
https://github.com/elixir-editors/vim-elixir/pull/538

Here is my fork:
https://github.com/sodapopcan/vim-elixir
Make sure you’re on the autoindent-embedded-views branch if you clone this one.

Thanks!

Most Liked

sodapopcan

sodapopcan

I just wanted to bump this. This has proven to be quite difficult (no surprises there) but I’ve been using this the past week and seems ok. I’m still wondering if anyone else can try this out and report back to me—it’s very hard to cover the all the edge-cases.

Also, for endwise.vim users, I was able to get a PR merged that fixes the whole inline fn -> end issue. I’m not sure how many people were feeling that pain as there was an issue open for over two years, or something like that, about it.

Ok, thanks!

cigrainger

cigrainger

Hey! I was just looking at this PR today. Fantastic work. This is something that’s been hurting me. I’ll be able to have a proper play with it tomorrow and report back. Thanks for doing this.

Last Post!

sodapopcan

sodapopcan

Awesome, thank you! The logic hasn’t gotten quite complex. I can probably simplify it a bit but I’m trying to cover some different known styles I’ve seen. One thing that can’t be supported (and doesn’t appear to be supported in regular html formatting) is self-closing tags without the />. I’m also not bothering with extra weird stuff that I never see that is still valid HTML (like having whitespace between between the opening brace and the tag name (< p>, for example).

I’m trying to support both these styles for eex and Surface:

| represents the cursor after a new line.

<%= live_component @socket,
   Component,
   id: "id",
   foo: "foo" %>
|

<%= live_component @socket,
   Component,
   id: "id",
   foo: "foo"
%>
|

<%= live_component @socket,
   Component,
   id: "id",
   foo: "foo" do %>
  |
<% end %>

<%= live_component @socket,
   Component,
   id: "id",
   foo: "foo" do
%>
  |
<% end %>

<Component
  foo="foo" />
|

<Component
  foo="foo"
/>
|

I’m not sure if anyone does anything else but I’d be interested to know.

Where Next?

Popular in Discussions Top

ricklove
I was just introduced to Elixir and Phoenix. I was told about the 2 million websocket test that was done 2 years ago. From my research, t...
New
AstonJ
If a newbie asked you about Phoenix Contexts, how would you explain the basics to them? Feel free to be as concise or in-depth as you li...
New
joeerl
I’m playing with Elixir - It’s fun. I think @rvirding does give Elixir courses these days. Re: files and database - when I given Erlang ...
New
pillaiindu
In django there is a cache framework backed by memcached. Rails also puts a lot of emphasis on caching, and even the idea of russian-doll...
New
chulkilee
Here are the list of HTTP client libraries/wrappers, and some thoughts on HTTP client in general. I’d like to hear from others how they w...
New
opsb
We’re considering our architecture from a viewpoint of scaling our traffic heavily over the next 6 months. Our current deployment is runn...
New
matthias_toepp
I’d love to hear what people think about Wisp, the new Gleam web framework started by Gleam’s primary creator Louis Pilfold. Gleam, alon...
New

Other popular topics Top

baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 44778 311
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
dblack
I’ve got an issue with an app and I’ve no idea of how to troubleshoot it. I’m hoping someone here might have seen something similar. I p...
New

We're in Beta

About us Mission Statement