本文介绍了如何在Eclipse中的多行注释中关闭'*'?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在使用Eclipse进行编码时,如何关闭在开始多行注释时出现的*注释?

When coding with Eclipse, how do you turn off the "*" comments that come up when you start a multi-line comment?

而不是看到这一点,

/**
* Here is a comment
* some more
*/

我可以收到吗?

/**
  Here is a comment
  some more
*/

如果你想知道/ **是因为我使用doxygen。

If you are wondering the "/**" is because I use doxygen.

推荐答案

如所述,您只能做到这一点意思是禁用前导星号)转到

As mentioned in this thread, you can only do that (meaning "disabling the leading asterisks") by going to

 Preferences > Java > Code Style > Code Templates

所以例如,如果您将字段的注释修改为:

So for example, if you modify the template for comments of a field into:

/**

 */

当您将评论一个字段时,将会以这种方式(中间没有任何星号)。

It will come that way (without any asterisk in the middle) when you will comment a Field.

但是,它违背了,直到jdk1.3(更新:)(如)...

但是,如的评论中的mays-in-eclipse / 1641933#comment56743173_1641933 :

However, it does go against the Sun convention for Java comment formatting up to jdk1.3 (update: current oracle link) (as seen also here)...
However, as noted in the comments by Amedee Van Gasse:






一个更简单的方法(如果您只需要对代码的某些注释执行此操作,而保持另一个使用标准样式)是多行注释出现时像这样:


An even simpler way (if you only need to do that for certain comments of your codes, while keeping the other one with the standard style) is, when a multi-line comment appear like this one:

/**
 *
 */

,您可以先删除一个前导星号,输入您的评论。

您将看不到其他领先的星号在每条新评论的开头都会出现。

, you can first remove the one leading asterisk, the enter your comments.
You will see no other leading asterisks are showing up at the beginning of each new line of comments.

 /**

  */

 /**
    My first line of comment
    My second line of comment
    My third line of comment
  */

这篇关于如何在Eclipse中的多行注释中关闭'*'?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 09:12