如何使用注释禁用部分代码的代码格式? [英] How to disable code formatting for some part of the code using comments?
本文介绍了如何使用注释禁用部分代码的代码格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想有选择地禁用
I'd like to selectively disable the IntelliJ IDEA code formatter for a portion of code just like I can in Eclipse. Does IntelliJ support this feature, and if so, how do I use it?
解决方案
Since version 13 it's possible to wrap the code with
// @formatter:off
...
// @formatter:on
IntelliJ IDEA v.2018+:
File > Settings > Editor > Code Style
IntelliJ IDEA v.2016+:
Preferences > Editor > Code Style
IntelliJ IDEA v.14+:
Preferences > Editor > Code Style > Formatter Control
You can change the formatter control markers, as long as they're in comments.
Ensure formatter markers in comments are enabled, as shown in the following figure:
这篇关于如何使用注释禁用部分代码的代码格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文