web-mode icon indicating copy to clipboard operation
web-mode copied to clipboard

Svelte - alignment/indent-region issues

Open YoloClin opened this issue 2 years ago • 3 comments

I have the following code:

<tr 
    on:click|preventDefault={event => true}
			    class="AAA">

If I edit this file as test.svelte, select the entire buffer and run indent-region, I would expect it to horizontally align the on:click and class attributes. If I rename the file to test.html and rerun, it aligns correctly. If I remove the pipe (|) character, it also correctly aligns. The pipe is used semi-regularly in svelte, https://svelte.dev/tutorial/event-modifiers .

Running indent-region multiple times against the poc will sometimes align it correctly, not sure why but that behavior isn't reproducible in real-world samples.

Have tested on web-mode latest, and confirmed via web-mode within apt repos on a vanilla Ubuntu VM.

YoloClin avatar Mar 19 '22 08:03 YoloClin

The following also breaks:

<Example
    a={b}
      c={d}
    e={f}
      g={h}
    i={j}
/>

The behavior changes when the character length of property a changes (e.g. abcdef={b}), also when values d and h are removed (c={}).

YoloClin avatar Mar 19 '22 09:03 YoloClin

should be fixed with last commit

fxbois avatar Aug 20 '22 19:08 fxbois

Thanks, can confirm both pocs are fixed!

YoloClin avatar Aug 20 '22 20:08 YoloClin