简体   繁体   English

如何在NetBeans模板中折叠注释?

[英]How to collapse comments in NetBeans template?

I'm somewhat of a novice programmer, and would like to include some tips in my NetBeans code by building a custom template. 我有些是新手程序员,并且想通过构建自定义模板在NetBeans代码中包括一些技巧。 However, my tips are... a bit on the long side. 但是,我的技巧是...有点长。 I decided to solve that problem by adding a tag above them in one line comments, something like //@Djikstra's . 我决定通过在一行注释中的上方添加标签来解决该问题,例如//@Djikstra's I want those comments to be automatically folded so that I don't have to scroll through hundreds of lines of code to get to the real code. 我希望这些注释自动折叠起来,这样我就不必滚动数百行代码即可获得真实的代码。 How should this be done? 应该怎么做? Pictures below should help illustrate this problem. 下面的图片应有助于说明此问题。

模板中的内容看起来像什么

This is what one tip looks like in template. 这就是模板中的一个提示。

自动生成后的外观

And this is what a tip should look like after auto-generation. 这就是自动生成后的提示外观。

It you add an editor fold around a comment, you can make it collapsed by default. 如果您在注释周围添加了一个编辑器折叠,则可以使其默认折叠。 For example: 例如:

// <editor-fold defaultstate="collapsed" desc="Handy tip">
/* start of comment
  This information is useful...
*/
// </editor-fold>

The key here is setting the defaultstate to collapsed which causes the comment to be collapsed when the file is first opened. 此处的关键是将defaultstatecollapsed ,这将导致在首次打开文件时折叠注释。

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

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