Skip to content

svelteSortOrder doesn't allow for comments after the style-tags, making using #region-#endregion tags impossible #473

Open
@andreasputlitz

Description

@andreasputlitz

If you have a sort order defined (or at least with the default one), it doesn't allow for HTML comments after the script tags, which is conflicting with my use of VS Code's #region-#endregion tags.

In long components, I wanted to wrap my logic, markup, and style in those region-tags, so I can fold them away. But the very last #endregion tag (which has to be inside of a comment) would always be moved before the style-tags by svelte-prettier.

This:

<!-- #region MARKUP -->
<body></body>
<!-- #endregion -->

<!-- #region STYLES -->
<style></style>
<!-- #endregion -->

Will be reformatted to this:

<!-- #region MARKUP -->
<body></body>
<!-- #endregion -->

<!-- #region STYLES -->
<!-- #endregion -->
<style></style>

Probably because it thinks that the comment is part of the markup, which is supposed to go before the style-tags. Maybe you can change that behaviour by making it ignore comments in the sort-order?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions