Cannot remove block comment in Eclipse after formatting(格式化后无法删除 Eclipse 中的块注释)
问题描述
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 中的块注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:格式化后无法删除 Eclipse 中的块注释
基础教程推荐
- 无法复制:“比较方法违反了它的一般约定!" 2022-01-01
- 修改 void 函数的输入参数,然后读取 2022-01-01
- Struts2 URL 无法访问 2022-01-01
- 问题http://apache.org/xml/features/xinclude测试日志4j 2 2022-01-01
- 如何对 Java Hashmap 中的值求和 2022-01-01
- RabbitMQ:消息保持“未确认"; 2022-01-01
- 使用堆栈算法进行括号/括号匹配 2022-01-01
- REST Web 服务返回 415 - 不支持的媒体类型 2022-01-01
- Spring AOP错误无法懒惰地为此建议构建thisJoinPoin 2022-09-13
- 存储 20 位数字的数据类型 2022-01-01
