Eclipse 代码格式化程序缩进双倍空格 - Intellij IDE
Eclipse Code Formatter indents with double amount of spaces - Intellij IDE
我已将 Eclipse 代码格式化程序配置为缩进 4 个空格,但在 运行 代码格式化程序之后我得到了两倍的空格。
当我使用 Intellij 的标准设置缩进时,我得到了正确数量的空格。
Checkstyle 规则:
<module name="Indentation">
<property name="basicOffset" value="4"/>
<property name="braceAdjustment" value="0"/>
<property name="caseIndent" value="4"/>
<property name="throwsIndent" value="4"/>
<property name="lineWrappingIndentation" value="4"/>
<property name="arrayInitIndent" value="4"/>
</module>
Eclipse 代码格式化程序:
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="4"/>
IDE 的设置:
运行 代码格式化程序后,什么会导致双倍大小的缩进?
我在“连续缩进”的 eclipse 代码格式化程序中遇到了相同的行为,空格的数量从 4 增加了一倍到 8。我的 eclipse 代码格式化程序文件有这些行:
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
带有“continuation_indentation”的最后一行设置为 2,这使我得出结论,这可能是 2 的一个因数(4 x 2 = 8,对)。我将值更改为“1”并且它起作用了。也许这有帮助。
顺便说一句。我在 Intellij 中的设置看起来和你的一样
我已将 Eclipse 代码格式化程序配置为缩进 4 个空格,但在 运行 代码格式化程序之后我得到了两倍的空格。
当我使用 Intellij 的标准设置缩进时,我得到了正确数量的空格。
Checkstyle 规则:
<module name="Indentation">
<property name="basicOffset" value="4"/>
<property name="braceAdjustment" value="0"/>
<property name="caseIndent" value="4"/>
<property name="throwsIndent" value="4"/>
<property name="lineWrappingIndentation" value="4"/>
<property name="arrayInitIndent" value="4"/>
</module>
Eclipse 代码格式化程序:
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="4"/>
IDE 的设置:
运行 代码格式化程序后,什么会导致双倍大小的缩进?
我在“连续缩进”的 eclipse 代码格式化程序中遇到了相同的行为,空格的数量从 4 增加了一倍到 8。我的 eclipse 代码格式化程序文件有这些行:
<setting id="org.eclipse.jdt.core.formatter.tabulation.char" value="space"/>
<setting id="org.eclipse.jdt.core.formatter.tabulation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
<setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="2"/>
带有“continuation_indentation”的最后一行设置为 2,这使我得出结论,这可能是 2 的一个因数(4 x 2 = 8,对)。我将值更改为“1”并且它起作用了。也许这有帮助。
顺便说一句。我在 Intellij 中的设置看起来和你的一样