[版权声明] 本站内容采用 知识共享署名-非商业性使用-相同方式共享 3.0 中国大陆 (CC BY-NC-SA 3.0 CN) 进行许可。
部分内容和资源来自网络,纯学习研究使用。如有侵犯您的权益,请及时联系我,我将尽快处理。
如转载请注明来自: Broly的博客,本文链接: JetBrains系IDE关闭代码格式化功能
可以在代码上通过用注释的方式,临时关闭代码格式化功能:
- 首先进入配置 Preferences > Editor > Code Style ,勾选Enable formatter markers in comments
2. 然后在代码上通过 @formatter:off 和 @formatter:on 开关格式化功能(注意不能有空格),比如
1 2 3 4 5 6 7 8 9 |
Java: // @formatter:off ... // @formatter:on XML: <!-- @formatter:off --> ... <!-- @formatter:on --> |
参考链接:
《How to disable code formatting for some part of the code using comments?》