Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

NetBeans: Code folds do not appear on one of my PHP files

I'm using the NetBeans IDE. Normally, every PHP file in my project has code folds:

code folds appear

However, one PHP file in my project doesn't have code folds:

code folds do not appear

The file has no syntax errors. I've tried restarting NetBeans and reopening the project and the folds still do not appear. What could it be?

More info:

  • I'm using NetBeans IDE 7.0.1.
  • The file's extension is .php like all the PHP files in my project.
  • On another file which has the same content exactly, code folds appear.
like image 570
snakile Avatar asked Aug 29 '11 08:08

snakile


People also ask

What is code folding in NetBeans?

The third class of NetBeans code folding is customized code folding where the developer marks sections of code that he or she wants to support NetBeans code folding. The last example of the servlet generation showed the syntax that developers can use to implement custom folding.

Why is NetBeans so good at folding import statements?

Because it is automatic in NetBeans, there is no trace of any special treatment of important statements in the source code. Anyone looking at the source code in an alternate editor that doesn't itself fold import statements will just see the lines of code like shown next:

Does NetBeans support code folding for Javadoc comments?

NetBeans offers automatic code folding for Javadoc comments similar to what it provides for import statements. I will again use the example code from my EasyMBean blog example to illustrate NetBeans's code folding of Javadoc comments.

How to filter out CSS parsing errors in NetBeans?

I recently switched from Vim to Netbeans. Show activity on this post. To filter out CSS parsing errors, Open CSS file that contains error and when you click on the error bulb (Which appears at the error line) you can see an option as 'filter out CSS parsing errors in 'yourprojectname''. Click it.


2 Answers

@ sudhir chauhan: If code folds wasn't already selected the other php files would not have folds alredy.

This is a known bug with Netbeans that is very annoying and happens occasionally to me as well when editing PHP. The only solution is to save the file, close the Netbeans IDE and re-open Netbeans.

Also sometimes you unfold code and click to refold and you cant.. to resolve this related issue just click on a line outside the fold (ie. the function above) then click on the "-" to refold the code.

like image 187
Dave Avatar answered Sep 17 '22 17:09

Dave


This problem persists in Netbeans 7.2.1, not only with PHP, but also with java code, the way that works for me is to uncheck [Use code fold:] as described in o0omycomputero0o's answer, apply changes by clicking OK, then recheck [Use code folding:], and click OK, it sort of re-validates the code folds to the expected state, No IDE reload needed.

like image 34
m_korena Avatar answered Sep 20 '22 17:09

m_korena