-
Notifications
You must be signed in to change notification settings - Fork 97
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
style content erased #255
Comments
Could you post the content of that file in here? |
I've got the same kind of problem here, and it's really strange.... The following file will get its <style> content stripped
Now if I remove anything from it, or even make the import path shorter, it won't get stripped anymore. |
Actually, I tried to share the code with one of my colleague to compare using copy/paste method but sometime is not exactly the same thing that result on each editors at the end, it is the reason why I preferred to provide it as an attachment (and it is too bad that we can not attach a svelte file directly). Regarding the strange behavior I think that it is important to have exactly the same code to compare. |
When snipping the tag contents, after replacing a match, we need to adjust the matching spans as the content length now differs. Else "is within other span" might give wrong results. Fixes sveltejs#255
When snipping the tag contents, after replacing a match, we need to adjust the matching spans as the content length now differs. Else "is within other span" might give wrong results. Fixes #255
Edit: I've created a new issue for it here: #261 @dummdidumm I think that was fixed at one point, but this stills happens with up to date packages. Repro:
At this point the dev dependencies are:
After npm install:
Then add the file content of my previous comment: #255 (comment) to src/routes/test.svelte Now both
If i downgrade prettier-plugin-svelte to 2.4.0, by removing the leading version caret in package.json, followed by npm install, I then get:
And this time formatting via either the cli or vscode option works as expected. |
For my case with prettier-plugin-svelte 2.5.0 it is fixed. Thanks. |
Hello,
I face a situation where the style content is erased by prettier, I tried to rearrange things in the file to find the problem cause but I definitely do not understand how it behaves.
For the moment my workaround is to avoid having a second script context="module", but I have such script in others of my files in which I did not see this problem.
The symptomatic file is in the zip archive:
sample.zip
The text was updated successfully, but these errors were encountered: