prettier-plugin-svelte icon indicating copy to clipboard operation
prettier-plugin-svelte copied to clipboard

`svelteStrictMode` still causes Svelte components to self-close

Open madupuis90 opened this issue 4 years ago • 3 comments

I tried both of these options to stop that behaviour :

  "svelte.plugin.svelte.format.config.svelteStrictMode": true,
  "svelte.plugin.html.completions.enable": false

With "svelte.plugin.svelte.format.config.svelteStrictMode": true, <div></div> does not become <div /> when saving. But <Container></Container> will still become <Container />

I tried to disable other html formatting but couldn't find any option that prevents self-closing of Svelte components

madupuis90 avatar Jul 11 '21 16:07 madupuis90

There's no option currently to stop this behavior, components without content are always self closed.

dummdidumm avatar Jul 11 '21 16:07 dummdidumm

Alright thanks! It's probably a niche case, but I usually create multiple components and paste them before filling them one by one and right now I had to go back and re-open the self closing each time.

madupuis90 avatar Jul 11 '21 16:07 madupuis90

I have a lot of elements that I like to keep open instead of being self closed. I think an option to disable self closing should be added in. Some of my components are designed to have slot elements and its annoying that some of my elements automatically self close.

Nukiloco avatar Oct 14 '21 10:10 Nukiloco

In version 3, components will be left as the user wrote them and not format one into the other.

dummdidumm avatar Jul 17 '23 11:07 dummdidumm