問題描述
Eclipse 的自動格式化程序會更改塊注釋,因此 Source > Remove Block Comment 不會完全刪除塊注釋.Source > Add Block Comment 將時鐘注釋的開始和結束添加到代碼行中,但是在運行 Formatter (Ctrl + Shift + F) 后,它會包裝代碼行并在每行的開頭添加一個星號.當我嘗試使用 Source > Remove Block Comment 刪除塊注釋時,塊注釋的開頭和結尾被刪除,但每行開頭的星號不會被刪除.
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);
應用格式后變成這樣:
/*
* 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 中的塊注釋的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!