Prettier on VS Code unfolds my code blocks on save
See original GitHub issueI’m using Prettier on VS Code with the editor.formatOnSave enabled. Every time I save my javascript file and prettier runs it unfolds all my functions. Is there a way to prevent this from happening?
I have a large javascript file and would like to keep the functions collapsed.
You can see in the GIF below that even adding a blank line unfolds a bunch of my functions.

Issue Analytics
- State:
- Created 5 years ago
- Reactions:4
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Prettier on VS Code unfolds my code blocks on save . How ...
I'm using Prettier on VS Code with the editor.formatOnSave enabled. Every time I save my (js)|| (jsx) file and prettier runs it unfolds...
Read more >How to enable auto format on save with prettier in VS Code ...
Explainer video about How to enable auto format on save in VS Code (Visual Studio Code ) editor with prettier code formatter extension...
Read more >VS Code tips — Fold all block comments - YouTube
Today's VS code command: Fold all block commentsCollapse all block comments in the current file. Use the " Unfold all" command to expand...
Read more >Visual Studio Code Tips and Tricks
VS Code blocks saving the file to prevent overwriting changes that have been made outside of the editor. In order to resolve the...
Read more >How to quickly collapse code blocks in VSCode
In VSCode terminology, the collapsible code blocks feature is called Fold/Unfold. You can quickly fold a block of code, given that your cursor ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

editor.foldingStrategyis the setting. experimental setting disappeared tho. It is now enabled by default as of VSCode 1.24as @cozuya said, setting
editor.foldingStrategyto “indentation” is maybe what you are looking for. I’ll close this issue as there is nothing we can really do here. And VSCode seems to handle it already.@CiGit Toggling this from
autotoindentationmade prettier stop un-folding everything.