Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 209284 - New PHP Code Folding nearly unusable
New PHP Code Folding nearly unusable
Product: php
Classification: Unclassified
Component: Editor
All All
: P3 with 5 votes (vote)
: 7.2
Assigned To: Ondrej Brejla
Depends on: 213107
  Show dependency treegraph
Reported: 2012-03-07 19:32 UTC by wnjordan
Modified: 2012-09-18 02:12 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT


Note You need to log in before you can comment on or make changes to this bug.
Description wnjordan 2012-03-07 19:32:09 UTC
Product Version = NetBeans IDE Dev (Build 201203050400)
Operating System = Linux version 2.6.35-32-generic running on amd64
Java; VM; Vendor = 1.6.0_20
Runtime = OpenJDK 64-Bit Server VM 19.0-b09

The IDE is automatically collapsing all looping structures on a page when it's opened - and- in the options I do not have "Tags and Other Code Blocks" checked.

Also, when I'm working on the code the ide is automatically collapsing code blocks as I work which is so annoying.

Another problem is that the code folding should not effect code that occurs on a single line.
Another bug is that when it does collapse, lets say an if/else statement for example, that's on a single line, you cannot expand it by clicking the plus as only the code after the if is expanded.  The only way to expand the code after the else is to double-click it.

The only way that I've found to be able to work on my scripts is to expand everything when I first open the file and then manually collapse all of the functions.  And, fyi, expand all doesn't always work.

At this point, it would be better for you guys to not include these new code folding features into 7.2 unless your going to spend the time to get them working right.

A few other upgrades to code folding that would make it on par with other IDE's:
1. In the Code Folds menu's add "Collapse/Expand All Function/Methods" & "Collapse/Expand All Comments"
2. Right mouse click options to expand everything a selected code block.
3. Cache the folded state of each file so that it can be restored to it's previous state when it's re-opened.  This would make the "Collapse By Default" options apply to only newly opened files.
4. Stop the IDE from automatically collapsing code while a file is being edited.
Comment 1 Ondrej Brejla 2012-03-09 07:39:20 UTC
Too many things in one issue. There should be one issue for every single problem (some of them are enhancement, some are workning for me, some are won't fix, etc...). At first try to use IDE with a new userdir (clear instal, don't import anything from previous versions).

Autocollapsing -> can't reproduce it (I have collapsed everything, I switch off autocollapsing of methods, tags, etc., reopen the IDE, and everything is expanded)

Collapse when writing code -> I can reproduce...quite annoying behavior

Single line -> enhancement

Double click -> won't fix (there is no other solution in the folding infrastructure -> not PHP module problem)

Expand all: works for me properly

It's in the dev build...and it's there for testing let you, our "dev build users", test it and find bugs...and that's exactly what you are doing now, aren't you? We are not able to find all you have to help us. And that's why we are releasing dev build...
Comment 2 Ondrej Brejla 2012-03-09 07:55:40 UTC
Just one note to "autocollapsing when editing", it happens in 7.1.1 as well. It's there for a long time...and I'm not sure, that it's a PHP module problem. We are just providing some offset ranges to folding infrastructure (from CSL API modules)...have to investigate it more.

And just to clarify...the behavior with new "folding blocks" is still the same as it was in previous versions (from PHP module point of view), we now just provide more offset blocks, so the "whole folding behavior" is still the same.
Comment 3 schlaefer 2012-06-13 15:12:25 UTC
Autocollapsing: I trigger it all the time in 7.2beta. Even when typing in a block:

(Product Version: NetBeans IDE Dev (Build 201206130001))

I'm not sure if do something wrong, but productivity clearly went down with the new code folding feature. Until is implemented imho Netbeans shouldn't ship with small code folding activated.

For 2. there's a ticket:
Comment 4 Ondrej Brejla 2012-06-14 07:17:34 UTC
As you can see...the both issues which affect this one are not caused by PHP has to be fixed there, I can't do anything with that on my side. Unfortunately. Hopefully they will fix it soon for next release.

And you can simply workaround it by switching autocollapsing off. I know, it's not so "cool" know.
Comment 5 hlupec 2012-07-26 09:45:52 UTC
Hi, php editor is quite unusable because of this issue.

Is there an option, that it will be fixed earlier than in next release? Some 'puncove koule' could be a reward:D
Comment 6 Ondrej Brejla 2012-07-26 12:37:40 UTC
If you mean that annoying autocollapsing when code template is applied (e.g. "fnc"), so it's the same behavior as in Java editor (if I have "Methods" option checked and type "Pm", it's pasted and collapsed)...maybe some great feature? :/

If you mean that issue, where collapsing of cycles, conditions and such is driven by "Methods" option...there is no other option since "Tags and Other Code Blocks" is owned by classes...and why? Because CSL doesn't implement an API for "Inner Classes" option. Just vote for issue #213107. Once it is implemented I can reimplement PHP folding. It's a one-line change. But until that, I think that it's better to have it under "Methods" then "classes...".

But with that "autocollapsing" I can't do anything :( You can file a new issue for Editor/Code Folding and you'll have my vote ;)

And afair this is one of my longes answers in BugZilla, so I think that I deserve that really tasty 'puncove koule', don't I? O:-)
Comment 7 Ondrej Brejla 2012-09-17 08:12:45 UTC
Fixed in web-main #c2024d0d5ea7
Comment 8 Quality Engineering 2012-09-18 02:12:13 UTC
Integrated into 'main-golden', will be available in build *201209180001* on (upload may still be in progress)
User: Ondrej Brejla <>
Log: #209284 - New PHP Code Folding nearly unusable

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo