Skip to content
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

HTML comment is duplicated when using Format on Save #205

Closed
ejoflo opened this issue Feb 14, 2021 · 5 comments · Fixed by #206
Closed

HTML comment is duplicated when using Format on Save #205

ejoflo opened this issue Feb 14, 2021 · 5 comments · Fixed by #206
Labels
bug Something isn't working

Comments

@ejoflo
Copy link

ejoflo commented Feb 14, 2021

When enabling "Format on Save" in VS Code settings, recently I've noticed that some comments are being duplicated on save. Here are two images:

Before:
Screen Shot 2021-02-14 at 9 42 46 AM

After:
Screen Shot 2021-02-14 at 9 43 00 AM

I didn't have this issue before and I can only prevent it by disabling "Format on Save" or unchecking "Format: Enable" in Settings under Extensions > Svelte.

@dummdidumm
Copy link
Member

Can you post a minimum reproducible and copy-pasteable code snippet?

@ejoflo
Copy link
Author

ejoflo commented Feb 15, 2021

If you save the following as a .svelte file and try to save it with "Format on Save" the same behavior as above should happen with the "Full image viewer" html comment. It will be duplicated on save.

<script>
</script>

<!-- Full image viewer -->
<FullImage on:close="{() => showFullImage()}" images="{tip.imgUrls}" size="{pageWidth > 1024 ? 'large' : 'medium'}" />

<div class="report-button" in:fade="{{ delay: 300, duration: 650 }}">
<Report id="{tip._id}" />
</div>

<style>
</style>

@dummdidumm dummdidumm transferred this issue from sveltejs/language-tools Feb 15, 2021
dummdidumm pushed a commit to dummdidumm/prettier-plugin-svelte that referenced this issue Feb 15, 2021
Search of comment belonging to those blocks was wrong
Fixes sveltejs#205
@dummdidumm dummdidumm added the bug Something isn't working label Feb 15, 2021
dummdidumm added a commit that referenced this issue Feb 15, 2021
Search of comment belonging to those blocks was wrong
Fixes #205
@dummdidumm
Copy link
Member

This was released in the VS Code extension version 104.4.2

@xuelink
Copy link

xuelink commented Oct 25, 2023

"prettier": "^2.8.0",
"prettier-plugin-svelte": "^2.10.1",
prettier.mp4

@icjosh10
Copy link

"prettier": "^2.8.0",
"prettier-plugin-svelte": "^2.10.1",

prettier.mp4

I'm experiencing the exact same thing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants