netbeans icon indicating copy to clipboard operation
netbeans copied to clipboard

Implementing folding for specific code blocks in java editor

Open Chris2011 opened this issue 3 years ago • 4 comments

Description

Code folding is a nice thing to collapse lots of code, unfortunately code folding is not possible in Java editor for condition blocks (if, else if, else), loops (do, for, while), switch/case blocks or try/catch blocks but it should as in other languages too.

Use case/motivation

Having the possibility to collapse/expand condition blocks, loop blocks and try/catch.

Related issues

No response

Are you willing to submit a pull request?

Yes

Code of Conduct

Yes

Chris2011 avatar Jul 28 '22 20:07 Chris2011

@Chris2011 there's no need to create an issue if you're already working on a pull request - it says this on the form, and just adds extra work.

neilcsmith-net avatar Aug 01 '22 08:08 neilcsmith-net

@neilcsmith-net Ahh ok, thx for the hint :). Maybe I overread it.

Chris2011 avatar Aug 01 '22 09:08 Chris2011

useful feature

istinnstudio avatar Aug 12 '22 06:08 istinnstudio

Thx, PR is still created, need to change some things first as requested :)

Chris2011 avatar Aug 12 '22 06:08 Chris2011

Any chance you could also include folding for /* */ style comments? It'd be really useful for hiding verbose explanations of what part of the code does or why

Happily-Coding avatar Sep 13 '22 18:09 Happily-Coding

@OnyxianSoul So normal block comments, not documentation comments, right? If yes, I will try.

Chris2011 avatar Sep 13 '22 20:09 Chris2011

It would be great if it could recognize continuous "//" multi line comments but why not be able to do it on "/**/" commented parts also. It would be useful if there was a way to fold/hide unfold/show all of them all at once.

istinnstudio avatar Sep 13 '22 23:09 istinnstudio

Any chance you could also include folding for /* */ style comments? It'd be really useful for hiding verbose explanations of what part of the code does or why

I had a look and it is already working. Go into a method, add /* Foo */ somwhere in the code and you can fold it. If you encounter a position, where this is not working, please create a new ticket with explicit steps to reproduce. @OnyxianSoul

Chris2011 avatar Nov 09 '22 20:11 Chris2011

Coming in NB 19

Chris2011 avatar May 22 '23 07:05 Chris2011