我想有选择地禁用 the IntelliJ IDEA code formatter部分代码just like I can in Eclipse 。 IntelliJ 支持此功能吗?如果支持,我该如何使用它?
最佳答案
从版本 13 开始,可以使用以下代码包装代码
// @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
您可以更改格式化程序控制标记,只要它们位于注释中即可。
<小时/>确保注释中的格式化程序标记已启用,如下图所示:
关于intellij-idea - 如何使用注释禁用代码某些部分的代码格式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3375307/