简体   繁体   English

VS Code 上的 Prettier 会在保存时展开我的代码块。 如何预防?

[英]Prettier on VS Code unfolds my code blocks on save . How to prevetn sthis?

I'm using Prettier on VS Code with the editor.formatOnSave enabled.我在启用了 editor.formatOnSave的 VS Code上使用 Prettier。 Every time I save my (js)||每次我保存我的(js)|| (jsx) file and prettier runs it unfolds all my functions . (jsx) 文件和更漂亮的运行它展开了我的所有功能 Is there a way to prevent this from happening?有没有办法防止这种情况发生?

I have a large React component and would like to keep the component collapsed.我有一个大型 React 组件,并希望保持组件折叠。

Setting editor.foldingStrategy to "indentation" in VScode settings will resolve your issue.在 VScode 设置中将editor.foldingStrategy设置为"indentation"将解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM