-
Notifications
You must be signed in to change notification settings - Fork 98
svelteStrictMode
still causes Svelte components to self-close
#238
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
Comments
There's no option currently to stop this behavior, components without content are always self closed. |
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. |
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. |
- add `svelteSelfCloseComponents` and `svelteSelfCloseElements` to specify whether or not empty elements/components should self-close. `svelteStrictMode` no longer has any effect on this behavior - `svelteAllowShorthand` now takes precedence over `svelteStrictMode`, which no longer has any effect on that behavior - `svelteStrictMode` is deprecated as future Svelte versions might coerce numbers coming from mustache tags inside strings into strings closes #348 closes #284 closes #279 closes #238 related to #377
- whether or not empty elements/components should self-close is now left to the user - in other words, if you write `<div />` or `<Component />` that stays as is, and so does `<div></div>`/`<Component></Component>`. `svelteStrictMode` no longer has any effect on this behavior - `svelteAllowShorthand` now takes precedence over `svelteStrictMode`, which no longer has any effect on that behavior - `svelteStrictMode` is deprecated as future Svelte versions might coerce numbers coming from mustache tags inside strings into strings closes #348 closes #284 closes #279 closes #238 related to #377 superseeds / closes #379 as less options = better
In version 3, components will be left as the user wrote them and not format one into the other. |
I tried both of these options to stop that behaviour :
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
The text was updated successfully, but these errors were encountered: