格式化后,无法在Eclipse中删除块注释 [英] Cannot remove block comment in Eclipse after formatting
问题描述
Eclipse的自动格式化程序更改块注释,以便源>删除块注释不会完全删除块注释。源>添加块注释将时钟注释的开始和结束添加到代码行,但是在运行格式化程序(Ctrl + Shift + F)之后,它会包装代码行,并在每行的开头添加一个星号。当我尝试使用源>删除块注释删除块注释时,块注释的开始和结束将被删除,但每行开始处的星号不会被删除。
Eclipse's automatic formatter changes block comments such that the Source > Remove Block Comment does not completely remove the block comment. Source > Add Block Comment adds the start and end of the clock comment to the lines of code, but after running the Formatter (Ctrl + Shift + F), it wraps the lines of code and adds an asterisk to the start of each line. When I try to remove the block comment with Source > Remove Block Comment, the start and end of the block comment is removed, but the asterisks at the beginning of each line is not removed.
如何防止Eclipse添加这些星号,或者在删除块注释的开始和结束时删除星号?
How do I prevent Eclipse from adding these asterisks, or remove the asterisks when it removes the start and end of the block comment?
示例:
代码如下:
String abc="abc";
String def="def";
System.out.println(abc+def);
System.exit(0);
添加块评论后变成这样:
Becomes like this after adding block comments:
/* String abc="abc";
String def="def";
System.out.println(abc+def);
*/ System.exit(0);
应用格式后,会变成这样:
Which becomes like this after applying formatting:
/*
* String abc="abc"; String def="def"; System.out.println(abc+def);
*/System.exit(0);
在使用移除阻止评论功能后,最终如此:
Which ends up like this after using the Remove Block Comment function:
* String abc="abc"; String def="def"; System.out.println(abc+def);
System.exit(0);
推荐答案
这可能在游戏中有点晚了,我通过禁用块注释格式来修复此问题。
This may be a little late in the game, but I fixed this by disabling block comment formatting.
Windows -> Preferences -> Java -> Code Style -> Formatter -> Edit -> Comments
然后取消选中启用块注释格式。
这篇关于格式化后,无法在Eclipse中删除块注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!