question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Formatter Bug] Comments of the parameters are indented incorrectly

See original GitHub issue

Expected Result

(Image Format)

image

(Text Format)
     * @param test
     *            test test test
     * @param test
     *            test test test test

Current Result

(Image Format)

image

(Text Format)
     * @param test
     *                 test test test
     * @param test
     *                 test test test test

Formatter XML Config

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<profiles version="12">
  <profile kind="CodeFormatterProfile" name="Test Formatter" version="12">
    <setting id="org.eclipse.jdt.core.formatter.comment.format_javadoc_comments" value="true"/>
    <setting id="org.eclipse.jdt.core.formatter.indentation.size" value="4"/>
    <setting id="org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column" value="false"/>
    <setting id="org.eclipse.jdt.core.formatter.comment.preserve_white_space_between_code_and_line_comments" value="false"/>
    <setting id="org.eclipse.jdt.core.formatter.comment.format_line_comments" value="true"/>
    <setting id="org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column" value="false"/>
    <setting id="org.eclipse.jdt.core.formatter.comment.format_block_comments" value="true"/>
    <setting id="org.eclipse.jdt.core.formatter.join_lines_in_comments" value="true"/>
  </profile>
</profiles>
Environment
  • Operating System: Windows 10
  • JDK version: jdk-14.0.2.12-hotspot
  • Visual Studio Code version: 1.53.0-insider
  • Java extension version: 0.74.0
Additional Informations

I can’t update the XML profile version because the project need to support old eclipse versions.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
CsCherrYYcommented, Feb 4, 2021

You can try this settings snippet:

<setting id="org.eclipse.jdt.core.formatter.comment.indent_parameter_description" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.indent_root_tags" value="true"/>
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions" value="false"/>

You can find (or add if not exists) these four settings in your profile and set them to the above value. I’ve tried it and works.

0reactions
DaniGTAcommented, Feb 9, 2021

That works! Thanks!

for vs-code i needed to add these:

<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_descriptions_grouped" value="false"/>
<setting id="org.eclipse.jdt.core.formatter.comment.align_tags_names_descriptions" value="false"/>

in intellij eclipse formatter plugin this is not needed. But i can live with that solution.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - [Formatter Bug] Comments of the parameters are ...
[Formatter Bug] Comments of the parameters are indented incorrectly.
Read more >
474362 – [formatter] New formatter is too aggressive ignoring ...
I'm running Eclipse Mars 4.5.1 M20150819-1000 (a maintenance build because I'm trying to get around all the *other* new formatter bugs such as...
Read more >
Eclipse / CDT auto-indent on new line only incorrect for structs?
Under Window , Preferences , C/C++ , Code Style , Formatter >> Edit >> Indentation >> Indent there are two options that can...
Read more >
Indentation Error in Python | How to Solve it - Edureka
While programming you have placed an indentation in the wrong place. Since python follows strict guidelines when it comes to arranging the code, ......
Read more >
Google C++ Style Guide
Comment Style; File Comments; Class Comments; Function Comments ... which in turn can make code more bug-prone and harder to read and maintain....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found