【发布时间】:2021-05-10 20:22:25
【问题描述】:
我正在尝试更改 Eclipse 格式化程序的设置,以便它不会对齐 param 标记描述的缩进。
这就是我的目标:
/**
* Creates a new CTScanData object holding the data from the given file path.
*
* @param dataFilePath Path to the file containing the CT scan data.
* @param width Width of the scan data (left to right).
* @param depth Depth of the scan data (front to back).
* @param height Height of the scan data (top to bottom).
*/
这就是格式化程序当前正在做的事情:
/**
* Creates a new CTScanData object holding the data from the given file path.
*
* @param dataFilePath Path to the file containing the CT scan data.
* @param width Width of the scan data (left to right).
* @param depth Depth of the scan data (front to back).
* @param height Height of the scan data (top to bottom).
*/
我尝试更改了几个设置,但没有成功。
- 在 Eclipse 格式化程序编辑器中,我禁用了“@param 之后的缩进描述”和“缩进 Javadoc 标记”。
- 在导出的 XML 文件中,我发现
org.eclipse.jdt.core.formatter.comment.indent_parameter_description设置为 false。我也尝试过实现这一点,但没有任何区别。
注意:我在 Visual Studio Code 中使用格式化程序,但我认为它与在 Eclipse 中使用它相比应该没有什么区别?每次更改后,我都会重新启动 Visual Studio Code 以确保应用更改。
【问题讨论】:
-
“我在 Visual Studio Code 中使用格式化程序,但与在 Eclipse 中使用相比,我认为它没有任何区别” --- @987654321 @ != Eclipse IDE,那么当您使用 Visual Studio Code (由 Microsoft 开发) 时,为什么要询问 Eclipse (由 Eclipse Foundation 开发)?跨度>
-
在 Eclipse (2020-12) 的
Align Javadoc tags in columns组合框中,选择Align descriptions to tag width或选择Don't align。 -
@Andreas VS Code 中的 Java 语言支持是通过 LSP 实现的无头 Eclipse(顺便说一下,微软是 Eclipse 基金会的成员)。所以它是 Eclipse 格式化程序,但没有格式化程序配置文件对话框。因此提出了这个问题。
-
@Andreas 在 VS Code 中,您还没有相应的 UI。您必须直接编辑
org.eclipse.jdt.core.prefs文件或使用Eclipse IDE 编辑该文件。见stackoverflow.com/a/53510327/6505250
标签: java eclipse javadoc code-formatting