Community
Participate
Working Groups
The addition of code folding for Java code is a nice welcome, but seems too specific. It would be really nice if the folding was much like JEdit's, where it is indention based and therefore the folding works with ANY text file that has indentions. This is especially useful for large XML/HTML/JSP files, and allows unlimited nesting of folds. The Java side keeps requesting folding of code blocks such as if/then, loops, etc. and by convention, these are indented in the code so therefore it would be covered by a generic indention based folding solution. To this day I still use JEdit to work with XML configuration files only because of its folding capabilities.
(In reply to comment #0) > It would be really nice if the folding was much like JEdit's, where it > is indention based and therefore the folding works with ANY text file that has > indentions. or how about some way to specify a token to maybe "hint" where to fold the line at. For example maybe the "{" character could be used, so that lines like: if( somereallylongname || someotherreallylongname || <tab character right here>someotherreallylongname ||somelastname){ would show the whole expression. This would work well also for coding blocks also like alot of bsd related source code has in it such as: static unsigned int somefunction(int somevariable, float someothervar){ code.... code.... }
I've been working with generics for some time now and all the type specification seems to make for some very long and less readable lines. Think it would be nice to have the specifications automatically folded, so that: Map<Integer,Collection<String>> map; would automatically be: Map<...> map; with some possibility of unfolding the specification within the line.
*** Bug 111304 has been marked as a duplicate of this bug. ***
(In reply to comment #3) > *** Bug 111304 has been marked as a duplicate of this bug. *** Even more generic than Robert's suggestion and related to the report in 111304, we should allow for the user to 'fold' any highlighted block of text. It should be easy to implement something along the lines of 1. Select text 2. Right-click->fold (OR Right-click->source->fold)
I think it may be worth leaving some ability for users to decide for themselves. Having some specific rules for particular types of code *can* help. I would for example quite like to see more folding options in Java code, e.g. 'fold annotations' so that I can have everything folded to start with, but annotations always showing. Of course having indentation on (configurable) tokens like '{' would address this problem for my particular case, but what if another user prefers annotations folded away? How would he configure an exception for @Something private String field; @SomethingElse public void doStuff() { ... } (i.e. what if you DO want that folded?) Another target for folding could be multiline comments that use single line commenting, e.g. '//' in Java, or '--' in SQL. So to me it seems reasonable to have a fairly generic mechanism as already suggested above, but maybe with extension points to be able to include out of the box foldings in plugins.
VSCode uses this idea of indentation to indent any code (JSON, TypeScript file, etc) and that's why it is so fast. I have implemented a generic reconclier which supports folding with indentation. If you are interested tell me and I could create a PR with my class. Regard's Angelo
(In reply to Angelo ZERR from comment #6) > I have implemented a generic reconclier which supports folding with > indentation. If you are interested tell me and I could create a PR with my > class. Yes please!
@Angelo: do you think you could contribute it soon enough (within the next month) to have it in Platform/Text as internal code so other Platform/Text bundle (such as generic editor) could use it? Then we could turn it into an API in Photon if need be.
> @Angelo: do you think you could contribute it soon enough (within the next month) to have it in Platform/Text as internal code so other Platform/Text bundle (such as generic editor) could use it? @Mickael with pleasure:) I will try do that, just find time.
(In reply to Mickael Istria from comment #8) > @Angelo: do you think you could contribute it soon enough (within the next > month) to have it in Platform/Text as internal code so other Platform/Text > bundle (such as generic editor) could use it? The code would have to go into the generic editor project(s).
(In reply to Dani Megert from comment #10) > The code would have to go into the generic editor project(s). Ok that's fine for now. If later we find it is valuable to other editors, we'll consider moving it as API in the org.eclipse.ui.editors project. But it's not something we want to do right now, so the generic editor plugin is a good host for this code.
This should be provided for the generic editor(s). *** This bug has been marked as a duplicate of bug 512956 ***