Eclipse formatter adds space in empty comment lines

后端 未结 4 1070
再見小時候
再見小時候 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:25

    I've also had this issue and solved it by doing a Search/Replace in Eclipse.

    1. Go to Search > File and be sure Regular Expression is checked.
    2. Enter the string ^([\s]+\*)([\s]+)$ into the Containing text field.
    3. Constrain your search to *.java File name patterns
    4. Press the Replace (not Search) button
    5. Make sure regular expression is checked in the Replace box and use the string $1 as a replacement. Replace at will.

    What this is doing is searching for lines that start with blank space characters that contain a * and then further blank space and no other content. It then replaces the whole line with the first matched part of the regex, which is just the initial spacing and * of the comment line.

提交回复
热议问题