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.
Summary: | Code folding for Inner Classes | ||
---|---|---|---|
Product: | editor | Reporter: | Ondrej Brejla <obrejla> |
Component: | CSL (API & infrastructure) | Assignee: | Svata Dedic <sdedic> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | hlupec, krisek, marfous, mmirilovic, sdedic, sonnysavage |
Priority: | P2 | ||
Version: | 7.2 | ||
Hardware: | All | ||
OS: | All | ||
See Also: | http://netbeans.org/bugzilla/show_bug.cgi?id=213106 | ||
Issue Type: | DEFECT | Exception Reporter: | |
Bug Depends on: | |||
Bug Blocks: | 209284 |
Description
Ondrej Brejla
2012-05-28 15:02:43 UTC
Defect...sice it's really missing in GsfFoldManager. Think that fix could be simple. Thanks. Looks like the folding in 7.2 RC1 (and the more recent dailies before that) had different folding behavior. The fold a few weeks ago, if I remember correctly worked like: l = new ActionListener() { @Override public void actionPerformed(ActionEvent e) { myMethodCall(); } }; To something like: l = new ActionListener() {[...] myMethodCall(); [...]} Now it is just: l = new ActionListener() {[...]} I felt that modified fold was very handy. What happened to it? (And, for those of us still using Java 6, the automatic "diamond operator" type fold was nice as well: l = new ArrayList<[...]>.) Same here. Please fix the code folding which includes methods and these annoying code folds for if/while/for statements. Just give us an extra option, so we can choose if we want to fold if/for/while/... statements, too. Nine votes should be enough to increase to P2. I think that at least for PHP is this really annoying. Mkristofic could you please set the expected target milestone? Thanks a lot. Please add options what to fold for php folding. Maybe only statements(if/for/while) with {} should be folded or depends on user settings Milutin, can you implement it please? 13 votes is quite enough ;) Thanks! (In reply to comment #2) > To something like: > l = new ActionListener() {[...] myMethodCall(); [...]} > > Now it is just: > l = new ActionListener() {[...]} > This feature (AFAIK) is not a part of a release, but can is provided by a contrib module 'java.ext.editor'. I originally wanted to make a clean-up and adopt the feature to the main line, but I don't think I can manage that for 7.3. The later described behaviour is the standard one - the entire inner/anonymous class body is collapsed/folded. Don't forget that we discuss 2 problems here. 1) One about implementing of "Inner Classes" folding for CSL, which is missing (Milutin's issue), 2) and another about Java folding (Svata's issue) The second one should have its own separate issue I think. And hope that the first one will be fixed soon ;) Thanks in advance. (In reply to comment #8) > Don't forget that we discuss 2 problems here. > ... > The second one should have its own separate issue I think. And hope that the > first one will be fixed soon ;) +1 The Java issue should be solved separately. I think that most of votes are related to annoying PHP folding (as reported in comment #0) and is, I would say, stopper for using method foldings in PHP right now. People, could you summarize what fold type constants do you now use in PHP and for what purpose ? I noticed that the top-level class is folded with "tag" ("tags and other code blocks") fold type. Is that correct ? This hack is used in Java folding as well, btw, but Java mod achieves the current behaviour by reusing "tag" type, while providing different setting as autocollapse value. I cannot do that in CSL as the autocollapse setting name is determined by the fold type. That said, PHP takes an approach different from Java, which does not fold top-levels, Java Fold manager does not report folds for toplevel classes at all -- that's why there's only "fold INNER classes" option in the Options dialog. Should be the top-level classes foldable ? And if so, should they fold in a different way than inner classes ? If both answers are "yes", we may need yet another setting (collapse top level classes), exposed in UI, and perhaps honoured by Java fold manager as well. Now we use: "Tags and Other" for Top level classes in PHP (since PHP has no inner classes...but we can have more top level classes in one file) and "Methods" for methods and for If, Else, Do...statements. But that's useless...we need an empty "Tags" just for these If, Else statements and let "Methods" just for methods. But then we need some another option for our classes. I thought that "Inner" classes solution would be "good enough" for our users. But if you wanna implement just another option, "Top Level Classes", it would be great as well. So my suggestion is to enable "Inner Classes" folding type for CSL languages (which is not working for now) and then implement whole new option "Top Level Classes". That first implementation part should be simple and fast I think, but I don't know how fast could be the second part :) So the conclusion, we, in PHP, just need to enable one option, which can handle classes - for NB 7.3 :) Not so important how is that option called ;) Thanks! Sorry for my ignorance about PHP syntax, I've never really worked with it except correcting someone else's scripts. If you think that the wording "Inner classes" wouldn't be confusing for users (and won't produce continuous defect flow ;)), I gladly agree with your proposal. I still hope that we will be able to somewhat open the fixed set of fold types to language-specific extensions in the future (incl. UI), so unless necessary I would not extend the current core set unless absolutely necessary. I think that they will be glad that they can somehow fold what they want, regardless the name of the option :) Thanks a lot. 14 votes -> P2 Changeset: 76bf738b761b Author: Svata Dedic <sdedic@netbeans.org> Date: 2012-09-13 16:30 Message: Issue #213107 - Code folding for Inner Classes: fixed Added 'inner-classes' folding type, bound to "Inner classes" UI option. Cleaned up copypasted code. Please use "inner-classes" as fold type. There's also unused "othercodeblocks" constant, which is currently mapped to "Tags and Other Code Blocks" option, consider to use this one for if/elses for better upwards compatibility. Integrated into 'main-golden', will be available in build *201209140001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress) Changeset: http://hg.netbeans.org/main-golden/rev/76bf738b761b User: Svata Dedic <sdedic@netbeans.org> Log: Issue #213107 - Code folding for Inner Classes: fixed Added 'inner-classes' folding type, bound to "Inner classes" UI option. Cleaned up copypasted code. Just downloaded last night's release. Here's what I've found in a PHP class file if I exclusively select any of these folding options: Methods - folds everything under class (class is expanded) including: - methods - if blocks - try/catch blocks - for/while loops - etc. Inner Classes - nothing folded Tags and Other Code Blocks - folds entire class from top, but everything under class is expanded What I really need is the (previously existing) option to fold ONLY methods while leaving all sub-elements (try/catch/if/for blocks) expanded. Would have thought checking off "methods" would do this. Is there any way to do this? It used to work this way before. You probably need to wait for the dependent defect #209283 to be fixed; this request deals just with the infrastructure PHP folks needed to fix the issue with PHP code folding. Thanks a lot Svato. OK. I'm confused. #209284 is flagged as RESOLVED WONTFIX. Does this mean this will never be addressed? As a PHP user code folding has become so frustrating I have to stop using netbeans. I spend a massive amount of time every time I open the IDE either manually folding all functions or manually unfolding all code blocks (if/switch/while/for/etc...) If there's no hope, I'd rather know now. Thanks. oddfish: that issue with strange methods/if, else statements is fixed for PHP in NB 7.3. You can try it in dev build. Many thanks! Build 201209260001 did the trick. |