Skip to content

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

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

Open
andreasputlitz opened this issue Nov 12, 2024 · 0 comments

Comments

@andreasputlitz
Copy link

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant