简体   繁体   中英

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. 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 . 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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