Eclipse formatter adds space in empty comment lines

后端 未结 4 1072
再見小時候
再見小時候 2021-02-02 06:39

The eclipse code formatter adds a trailing space in each empty Javadoc comment line (see screenshot).

\"enter

4条回答
  •  南笙
    南笙 (楼主)
    2021-02-02 07:03

    I found that if you go to Preferences → Java → Editor → Content Assist → Save Actions the following configuration works most of the time:

    • ☑ Perform the selected actions on save
      • ☐ Format source code
    • ☑ Additional actions
      • Remove trailing white spaces on all lines

    (That is to say, turn off the Format source code option in Save Actions, but keep the Remove trailing white spaces on all lines in Additional actions on.)

    The formatter and save actions duke it out, but save actions seems to win most of the time. The downside of this is that you need to periodically manually format the code.

    This is using Eclipse Juno.

提交回复
热议问题