Skip to content

Formatter removes comments in specific contexts #3151

Closed
sveltejs/prettier-plugin-svelte
#551

Description

@lemonlime4

Describe the bug

The following comments get deleted.

<p /* a > b , c */ ></p>
<br /* a > b , c */ />

Reproduction

Put the above code in a .svelte file and format the document using Prettier

Expected behaviour

Comments shouldn't disappear

System Info

  • OS: Windows
  • IDE: VSCode

Which package is the issue about?

Svelte for VS Code extension

Additional Information, eg. Screenshots

No response

Activity

  1. MFA-G commented on Oct 21, 2026

    @MFA-G

    This comes from prettier-plugin-svelte: comments in an opening tag without attributes are never attached, and a > inside a comment ends the tag-range scan too early. I opened a fix in sveltejs/prettier-plugin-svelte#551.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions