This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 125191

Summary: Add "insert code folding comments"
Product: editor Reporter: rcasha <rcasha>
Component: Code foldingAssignee: issues@editor <issues>
Status: VERIFIED FIXED    
Severity: blocker CC: hmichel, jkovalsky
Priority: P3 Keywords: NETFIX, SIMPLEFIX
Version: 6.x   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:
Attachments: Simple patch for 6.7
Patch for x-c, x-c++ and x-h
Patch for x-php5

Description rcasha 2008-01-14 08:04:59 UTC
It would be useful to add the following Macro by default to the editor:

// <editor-fold defaultstate="collapsed" desc=" ${DESCRIPTION} ">
${selection line}${cursor}
// </editor-fold>

With this, in the editor you can select multiple lines and use the "light bulb" menu to Surround with... Code folding
and get the opening/closing comments for code folding.
Comment 1 Vitezslav Stejskal 2008-01-23 10:04:18 UTC
Yes, this could be useful. Thanks. Just for the record, you meant this to be added as a code template, right?
Comment 2 rcasha 2008-01-23 10:24:45 UTC
Yes, that's right.
Comment 3 Jiri Prox 2008-04-11 00:44:16 UTC
moving opened issues from TM <= 6.1 to TM=Dev
Comment 4 Jiri Kovalsky 2009-03-30 14:23:05 UTC
Vita Stejskal agreed that he would review and integrate a patch for this issue contributed by the NetFIX [1] team.

[1] http://wiki.netbeans.org/NetFIX
Comment 5 Michel Graciano 2009-03-31 03:32:31 UTC
Created attachment 79105 [details]
Simple patch for 6.7
Comment 6 Vitezslav Stejskal 2009-03-31 14:53:55 UTC
Patch applied - http://hg.netbeans.org/jet-main/rev/f1a0c0ebfe62. Please consider adding the same template to other
languages too. There might be different line comment character, but the rest of the template is the same. Thanks
Comment 7 Michel Graciano 2009-03-31 17:40:29 UTC
No problems about other languages, but, which ones should I implement? I am thinking about JSP, XML and HTML. Which
more? I think we should have one issue for each language, since the sources are from different components.

Regards
Comment 8 Michel Graciano 2009-03-31 18:02:57 UTC
I tested this feature for another languages as HTML, XML, SQL and so on, and it doesn't work for any one except Java.
Can someone confirm it for me?

Regards
Comment 9 rcasha 2009-04-01 04:28:23 UTC
Yes, I think the code-folding feature is only available in the Java editor.
Comment 10 Vitezslav Stejskal 2009-04-01 09:54:17 UTC
"I am thinking about JSP, XML and HTML. Which more?" - Php, Ruby, Groovy, C/C++. Maybe others, but these plus those you
mentioned are the main ones.

"I think we should have one issue for each language" - this won't be neccessary.

"I tested this feature for another languages as HTML, XML, SQL and so on, and it doesn't work for any one except Java."
- Ah, it should generally work for all languages, but perhaps not all languages register this particular FoldManager.
I'll try to find what languages do register it and let you know. If it's really only java, then I apologize for a false
alarm and we will be able to close the issue. 
Comment 11 Vitezslav Stejskal 2009-04-01 13:20:48 UTC
I found the following languages (mimetypes) that are using CustomFoldManager, which is the one that recognizes
<editor-fold> tags in comments: x-c, x-c++, x-h, x-php5, and x-java obviously.

If you could add the template to them that would be great. If not, it's ok and I'll close the issue as FIXED. Thanks
Comment 12 Michel Graciano 2009-04-01 14:00:23 UTC
I'll work on it soon. Thanks for advise and if I found any problem I let you know.
Thanks
Comment 13 Quality Engineering 2009-04-02 07:31:59 UTC
Integrated into 'main-golden', will be available in build *200904020200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/f1a0c0ebfe62
User: Vita Stejskal <vstejskal@netbeans.org>
Log: #125191 - Add "insert code folding comments" (applying NetFIX patch)
Comment 14 Michel Graciano 2009-04-03 00:28:58 UTC
Created attachment 79325 [details]
Patch for x-c, x-c++ and x-h
Comment 15 Michel Graciano 2009-04-03 01:30:47 UTC
Created attachment 79328 [details]
Patch for x-php5
Comment 16 Michel Graciano 2009-04-03 01:31:58 UTC
I fixed for all languages. Regards
Comment 17 Vladimir Voskresensky 2009-04-03 10:38:33 UTC
I'm fine to apply C++ patch
Comment 18 Michel Graciano 2009-04-03 11:21:55 UTC
Just let me know about changesets.
Thanks.
Comment 19 Vladimir Voskresensky 2009-04-04 10:09:07 UTC
pushed into cnd-main
http://hg.netbeans.org/cnd-main?cmd=changeset;node=c36d0ee6ef02

you will see when it is propagated into production (in this iz will appear comment from qa@netbeans org with changeset
information)
Comment 20 Quality Engineering 2009-04-05 07:38:55 UTC
Integrated into 'main-golden', will be available in build *200904050200* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/c36d0ee6ef02
User: Vladimir Voskresensky <vv159170@netbeans.org>
Log: fixing #125191 - Add 'insert code folding comments' (applying NetFIX patch)
Comment 21 Vitezslav Stejskal 2009-04-06 13:17:10 UTC
I pushed the php.editor changes - http://hg.netbeans.org/jet-main/rev/6e0d63c7adfc
Thanks hmichel!
Comment 22 Quality Engineering 2009-04-08 07:49:44 UTC
Integrated into 'main-golden', will be available in build *200904080201* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/6e0d63c7adfc
User: Vita Stejskal <vstejskal@netbeans.org>
Log: #125191: Add 'insert code folding comments'; applying NetFIX patch
Comment 23 Quality Engineering 2009-04-08 19:58:55 UTC
Integrated into 'main-golden', will be available in build *200904081400* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main-golden/rev/6e0d63c7adfc
User: Vita Stejskal <vstejskal@netbeans.org>
Log: #125191: Add 'insert code folding comments'; applying NetFIX patch
Comment 24 Michel Graciano 2009-09-02 19:55:23 UTC
v.