Intellij idea 如何在IntelliJ Idea';中为循环配置不同的内部间距规则;s代码样式设置?

Intellij idea 如何在IntelliJ Idea';中为循环配置不同的内部间距规则;s代码样式设置?,intellij-idea,Intellij Idea,我目前正在从事一个Java项目,我发现IntelliJ Idea的代码风格系统非常令人沮丧,因为它拒绝接受我想要给它的设置。具体地说,我希望各种操作符周围都有空格,除非它们在for循环的头中。例如,应输出以下代码: for(int x=0;x<10;++x){ // no spaces around operators when they're in a for loop's header System.out.println(x); } int a = 10; //spaces

我目前正在从事一个Java项目,我发现IntelliJ Idea的代码风格系统非常令人沮丧,因为它拒绝接受我想要给它的设置。具体地说,我希望各种操作符周围都有空格,除非它们在for循环的头中。例如,应输出以下代码:

for(int x=0;x<10;++x){ // no spaces around operators when they're in a for loop's header
    System.out.println(x);
}

int a = 10; //spaces around = when not in a for loop's header
int b = 50;
a = b;
if(a < b){ //an if statement is not a for loop's header
    doSomething();
}

用于(int x=0;xYou希望在关系运算符周围有不一致的格式化行为,我怀疑这是可能的。什么IDE支持这种格式化?@NeplatnyUdaj我不知道有没有IDE支持或不支持这种格式化。Eclipse有可能支持,因为我在学习Java和养成习惯时使用过它。在这种情况下,您可能想尝试Eclipse格式化程序插件。但我严重怀疑任何IDE都不支持这种代码样式。IntelliJ IDEA中没有这样的设置,也没有接受这种格式的公共代码样式标准。如果您将来想与其他开发人员合作,通常最好习惯一种广为接受的代码样式,而不是坚持使用这种样式坚持一种没有其他人使用的风格。