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

Comments get removed from formated Svelte Component #207

Closed
SaintPepsi opened this issue Feb 15, 2021 · 7 comments · Fixed by #208
Closed

Comments get removed from formated Svelte Component #207

SaintPepsi opened this issue Feb 15, 2021 · 7 comments · Fixed by #208
Labels
bug Something isn't working

Comments

@SaintPepsi
Copy link

Hi when I format a svelte component, any comment that is at the end of an element gets removed.

Gets removed:

<div>
    <div/>
    <!-- testing 123 -->
</div>

Doesn't get removed:

<div>
    <!-- testing 123 -->
    <div/>
</div>

Any solutions?

@dummdidumm
Copy link
Member

I cannot reproduce this given your code snippet. Which version of the plugin are you using?

@SaintPepsi
Copy link
Author

Hi, I use Svelte for VS Code v 104.4.1.

@SaintPepsi
Copy link
Author

SaintPepsi commented Feb 16, 2021

I just discovered something else.

It only happens when you have style tags in the document

Following removes last comment on format

<div>
  <!-- test -->
  <p />
  <!-- test -->
</div>
<style>
</style>

@dummdidumm dummdidumm added the bug Something isn't working label Feb 17, 2021
dummdidumm pushed a commit to dummdidumm/prettier-plugin-svelte that referenced this issue Feb 17, 2021
When checking if an embed starts after a node, return early if that node is not at the top level of html, because embeds cannot start after it.
Fixes sveltejs#207
dummdidumm added a commit that referenced this issue Feb 17, 2021
When checking if an embed starts after a node, return early if that node is not at the top level of html, because embeds cannot start after it.
Fixes #207
@SaintPepsi
Copy link
Author

SaintPepsi commented Feb 17, 2021 via email

@dummdidumm
Copy link
Member

I'll write in here once it's released for VS Code

@dummdidumm
Copy link
Member

This was released in the VS Code extension version 104.4.2

@SaintPepsi
Copy link
Author

That's great! Thanks.

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.

2 participants