有没有办法让java eclipse格式化程序不对齐@param描述?

问题描述

我正在尝试更改 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).
 */

我尝试更改了一些设置,但没有运气。

  1. 在 Eclipse 格式化程序编辑器中,我禁用了“@param 后缩进描述”和“缩进 Javadoc 标签”。
  2. 在导出的 XML 文件中,我发现 org.eclipse.jdt.core.formatter.comment.indent_parameter_description 设置为 false。我也尝试过实现这一点,但没有任何区别。

注意:我在 Visual Studio Code 中使用格式化程序,但我认为它与在 Eclipse 中使用它相比没有任何区别?每次更改后,我都会重新启动 Visual Studio Code 以确保应用了更改。

解决方法

请确保您在 .settings/org.eclipse.jdt.core.prefs 中有以下内容:

org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=false