Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implementing folding for specific code blocks in java editor #4447

Closed
Chris2011 opened this issue Jul 28, 2022 · 9 comments
Closed

Implementing folding for specific code blocks in java editor #4447

Chris2011 opened this issue Jul 28, 2022 · 9 comments
Assignees
Labels
Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) kind:feature A feature request work-in-progress

Comments

@Chris2011
Copy link
Contributor

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 Chris2011 added kind:feature A feature request needs:triage Requires attention from one of the committers labels Jul 28, 2022
@Chris2011 Chris2011 self-assigned this Jul 28, 2022
@Chris2011 Chris2011 added Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) work-in-progress labels Jul 28, 2022
Chris2011 pushed a commit to Chris2011/netbeans that referenced this issue Jul 28, 2022
conditions, loops and try/catch

The motivation about this was to implement those missing folding blocks in java editor. This was just implemented for imports, classes, inner classes, methods but not for stuff inside methods like if/else if/else, try/catch and loops because all of them are treated like as code blocks.
Chris2011 pushed a commit to Chris2011/netbeans that referenced this issue Jul 28, 2022
conditions, loops and try/catch

The motivation about this was to implement those missing folding blocks in java editor. This was just implemented for imports, classes, inner classes, methods but not for stuff inside methods like if/else if/else, try/catch and loops because all of them are treated like as code blocks.
Chris2011 pushed a commit to Chris2011/netbeans that referenced this issue Jul 28, 2022
conditions, loops and try/catch

The motivation about this was to implement those missing folding blocks in java editor. This was just implemented for imports, classes, inner classes, methods but not for stuff inside methods like if/else if/else, try/catch and loops because all of them are treated like as code blocks.
Chris2011 added a commit to Chris2011/netbeans that referenced this issue Jul 28, 2022
conditions, loops and try/catch

The motivation about this was to implement those missing folding blocks in java editor. This was just implemented for imports, classes, inner classes, methods but not for stuff inside methods like if/else if/else, try/catch and loops because all of them are treated like as code blocks.
Chris2011 pushed a commit to Chris2011/netbeans that referenced this issue Jul 29, 2022
conditions, loops and try/catch

The motivation about this was to implement those missing folding blocks in java editor. This was just implemented for imports, classes, inner classes, methods but not for stuff inside methods like if/else if/else, try/catch and loops because all of them are treated like as code blocks.
@neilcsmith-net neilcsmith-net removed the needs:triage Requires attention from one of the committers label Aug 1, 2022
@neilcsmith-net
Copy link
Member

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

@Chris2011
Copy link
Contributor Author

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

@istinnstudio
Copy link

useful feature

@Chris2011
Copy link
Contributor Author

Chris2011 commented Aug 12, 2022

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

@Happily-Coding
Copy link

Happily-Coding commented Sep 13, 2022

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

@Chris2011
Copy link
Contributor Author

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

@istinnstudio
Copy link

istinnstudio commented Sep 13, 2022

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.

Chris2011 pushed a commit to Chris2011/netbeans that referenced this issue Oct 25, 2022
Chris2011 added a commit to Chris2011/netbeans that referenced this issue Oct 25, 2022
separate from method fold type for customization
Chris2011 pushed a commit to Chris2011/netbeans that referenced this issue Nov 9, 2022
@Chris2011
Copy link
Contributor Author

Chris2011 commented Nov 9, 2022

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 added a commit to Chris2011/netbeans that referenced this issue May 6, 2023
to the method block for deprecated Java Editor Lib
Chris2011 pushed a commit to Chris2011/netbeans that referenced this issue May 16, 2023
…itions, loops and try/catch

The motivation about this was to implement those missing folding blocks in java editor. This was just implemented for imports, classes, inner classes, methods but not for stuff inside methods like if/else if/else, try/catch and loops because all of them are treated like code blocks.

Also introducing code-block fold type for specific code parts and separate from method fold type for customization. Add missing implementation of new method for method folding and add method folding to deprecated Java Editor lib as requested. Map the code block to the method block for deprecated Java Editor Lib
Chris2011 pushed a commit that referenced this issue May 21, 2023
…, loops and try/catch

The motivation about this was to implement those missing folding blocks in java editor. This was just implemented for imports, classes, inner classes, methods but not for stuff inside methods like if/else if/else, try/catch and loops because all of them are treated like code blocks.

Also introducing code-block fold type for specific code parts and separate from method fold type for customization. Add missing implementation of new method for method folding and add method folding to deprecated Java Editor lib as requested. Map the code block to the method block for deprecated Java Editor Lib
@Chris2011
Copy link
Contributor Author

Coming in NB 19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Java [ci] enable extra Java tests (java.completion, java.source.base, java.hints, refactoring.java, form) kind:feature A feature request work-in-progress
Projects
None yet
Development

No branches or pull requests

4 participants