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

Folding the script tag hides its closing tag #1120

Closed
juancpgo opened this issue Jul 28, 2021 · 5 comments
Closed

Folding the script tag hides its closing tag #1120

juancpgo opened this issue Jul 28, 2021 · 5 comments
Labels
Fixed Fixed in master branch. Pending production release.

Comments

@juancpgo
Copy link

When editing .svelte files, the script closing tag </script> gets hidden by VS Code when I fold it.
Screen Shot 2021-07-28 at 12 42 23

It doesn't happen with any other html tag, and it doesn't happen if I switch the file extension to .html.

If I rename script to anything else, the closing tag shows up:
Screen Shot 2021-07-28 at 12 57 20

Does anyone know why? Is there a solution?

@juancpgo
Copy link
Author

ps: My VS Code settings folding strategy is set to "indentation". But switching it to "auto" doesn't solve the problem.

@jasonlyu123
Copy link
Member

We have special treatment with the script and style tag so that it can be folded without indentation. I don't know if it's possible to show the end tag.

@juancpgo
Copy link
Author

We have special treatment with the script and style tag so that it can be folded without indentation. I don't know if it's possible to show the end tag.

So that must be it, because I realize those other tags (style and template) also behave the same way.

Can I remove that special treatment? How do I do it?
(I'd like them to behave as the others tags, I use indentation the same way)

@dummdidumm
Copy link
Member

Unfortunately it's not possible to remove that special treatment (well, you could go into the folder where the extension is installed, find the JSON file and change it there, but that's not a viable workaround I guess). We are stuck in an either-or-situation here. If we remove the special handling for these three tags, #523 is broken again, which would be worse than living with the minor inconvenience that the folded tags don't show their end tag.

@quoid
Copy link

quoid commented Mar 12, 2022

well, you could go into the folder where the extension is installed, find the JSON file and change it there, but that's not a viable workaround I guess

That's what I ended up doing. I guess it would be ideal to give the user an option to decide between showing a closing tag or being able to collapse <style> tags that have style code that isn't indented. That assumes a user settings can update/change actually disable something in language-configuration.json...

dummdidumm pushed a commit that referenced this issue Oct 10, 2023
#1704
#1120

This adds the syntactic folding range support instead of the VSCode's default indentation-based and regex-based folding. For embedded languages like Pug and Sass, I added a simplified version of indentation folding. The indentation folding is also a fallback for svelte blocks if there is a parser error.
@dummdidumm dummdidumm added the Fixed Fixed in master branch. Pending production release. label Oct 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Fixed Fixed in master branch. Pending production release.
Projects
None yet
Development

No branches or pull requests

4 participants