简体   繁体   English

可以告诉NetBeans不要重新格式化单行Javadoc注释吗?

[英]Can NetBeans be told to not reformat single-line javadoc comments?

Occasionally, I leave a comment like this above a class field: 有时,我会在类字段上方留下这样的评论:

/** absolute path */
private String path;

Now, this is a trivial example and I could easily avoid the need for this comment by naming it absPath, but there are much less well known and more cumbersome field names: for those, a short, although not completely intuitive name is often practical, so a javadoc comment like the one above makes the meaning very clear for newcomers to the project. 现在,这是一个简单的示例,我可以通过将其命名为absPath来轻松避免对此注释的需要,但是鲜为人知且麻烦得多的字段名:对于这些字段名,一个简短而又不完全直观的名称通常是实用的,因此,像上面这样的javadoc注释对于该项目的新手来说非常清楚。

My problem is that the NetBeans autoformatter will convert it to the extremely space-wasting, importance-overrating form below: 我的问题是,NetBeans自动格式化程序会将其转换为以下非常浪费空间,重要性重估的形式:

/**
 * absolute path
 */
private String path;

The only alternative that I see is to disable comment reformatting altogether, but I want comment reformating: I just don't want this particular kind of reformatting. 我看到的唯一选择是完全禁用评论重新格式化,但是我想重新格式化评论:我只是不想这种特殊的重新格式化。

Is there a way to have my cake and eat it, too? 还有办法吃我的蛋糕吗?

you could comment like this 你可以这样评论

// absolute path
private String path;

I may be completely off, but i looked into Tools->Options->Editor->Formatting (Java) (Comments) - i hope you find that, there is an example for how to achieve what i believe you want... 我可能完全不了解,但是我查看了“工具”->“选项”->“编辑器”->“格式化(Java)(注释)”-我希望您能找到一个例子,说明如何实现我认为自己想要的...

/* commeting comment */ / *欢迎评论* /

i think the difference is one star in the beginning of your comment - hope it works... 我认为区别在于您评论的开头-希望它能起作用...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM