【问题标题】:Documentation on Eclipse Code Formatter XmlEclipse Code Formatter Xml 文档
【发布时间】:2021-08-28 16:29:39
【问题描述】:

我正在寻找关于 Eclipse 代码格式化程序中不同参数的良好文档来源。我找到了一些关于堆栈溢出的特定参数的好例子,但找不到任何全面的参数列表或不同间距选项的列表。例如,Google formatter file 中的一项设置是

<setting id="org.eclipse.jdt.core.formatter.alignment_for_annotations_on_parameter" value="1040"/>

我已经看到了 16、48、80、81、1040 和 1585 等各种事物的对齐值,但似乎找不到任何具体的例子,这些例子都试图做什么。我知道 16 试图将所有内容放在一行上,而 80 也这样做,但如果发生换行符,它会将所有参数移动到自己的行。

如有任何帮助,我们将不胜感激。

【问题讨论】:

    标签: java visual-studio-code formatting eclipse-formatter


    【解决方案1】:

    目前,vscode-java 使用 Eclipse Formatter 样式,例如您提到的 Google Formatter

    尽管您已经知道为参数对齐分配特定值的设置。还有另一种设置可以控制参数是合并在一行中还是保存在不同的行中:

    <setting id="org.eclipse.jdt.core.formatter.continuation_indentation" value="1" />
    <setting id="org.eclipse.jdt.core.formatter.join_wrapped_lines" value="false"/>
    

    详细信息请查看Java formatting: Keep lines but fix indentation

    您可以尝试更改您机器上的 google_style.xml 以找到您想要的内容。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-05-01
      • 2018-02-12
      • 2014-07-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-11-08
      相关资源
      最近更新 更多