4

I am trying to change the settings of the Eclipse formatter so that it doesn't align the indentation of the param tag descriptions.

This is what I am aiming for:

/**
 * 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).
 */

And this is what the formatter is currently doing:

/**
 * 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).
 */

I have tried changing a couple of setting with no luck.

  1. In the Eclipse formatter editor I disabled the "Indent description after @param" and "Indent Javadoc tags".
  2. In the exported XML file, I found org.eclipse.jdt.core.formatter.comment.indent_parameter_description set as false. I also tried making this true, but it made no difference.

Note: I'm using the formatter in Visual Studio Code, but I don't think it should make any difference compared to using it in Eclipse? After each change I restarted Visual Studio Code to make sure that the changes were applied.

richard2706
  • 45
  • 1
  • 6
  • *"I'm using the formatter in Visual Studio Code, but I don't think it should make any difference compared to using it in Eclipse"* --- [Visual Studio Code](https://code.visualstudio.com/) != [Eclipse IDE](https://www.eclipse.org/eclipseide/), so why are you asking about Eclipse *(developed by Eclipse Foundation)* when you're using Visual Studio Code *(developed by Microsoft)*? – Andreas Feb 06 '21 at 20:08
  • In **Eclipse** (2020-12), in the `Align Javadoc tags in columns` combo-box, select `Align descriptions to tag width` or select `Don't align`. – Andreas Feb 06 '21 at 20:20
  • 3
    @Andreas The Java language support in VS Code is a headless Eclipse via LSP (and by the way, Microsoft is a member of the Eclipse Foundation). So it is the Eclipse formatter, but yet without the formatter profile dialog. Hence this question. – howlger Feb 06 '21 at 21:55
  • 2
    @Andreas In VS Code you do not have an UI for that yet. You have to edit the `org.eclipse.jdt.core.prefs` file directly or use the Eclipse IDE to edit the file. See https://stackoverflow.com/a/53510327/6505250 – howlger Feb 06 '21 at 22:03

1 Answers1

4

Make sure you have the following in .settings/org.eclipse.jdt.core.prefs for that:

org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped=false
howlger
  • 31,050
  • 11
  • 59
  • 99