fxbois / web-mode

web template editing mode for emacs
https://web-mode.org
GNU General Public License v3.0
1.63k stars 262 forks source link

Svelte - alignment/indent-region issues #1233

Closed YoloClin closed 1 year ago

YoloClin commented 2 years ago

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 commented 2 years ago

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={}).

fxbois commented 2 years ago

should be fixed with last commit

YoloClin commented 2 years ago

Thanks, can confirm both pocs are fixed!