Question

Recently I started using NetBeans 6.7 beta for PHP development instead of Textmate and MacGDBp. I am rather amazed with it's feature set and most everything worked out of the box, or was easily configured to my liking.

I am having an issue with the code completion features though; they work for built-in functions, SPL and some of my code, but not all of my code, specifically, it never works for any methods in my classes, regardless of PHPDoc comments.

I can't seem to find any decent questions, let alone answers about this specific subject anywhere. It looks like everybody else who has problems with the code completion just hasn't enabled the auto-popup feature.

So the big question is:

Is there any way to influence the code completion cache, or something I have to add to my code to make it work? I'd really like to have code completion for the methods I write.

PS: I have tried several older versions of netbeans, they all exhibit the same problem.

edit: I've put a .zip up of my current test project. get it here. It's a very young project, think a day and a half.

edit2: Below is a screenshot of what i'm looking at. As you can see, it fails to complete pretty much anything, nor does it see the PHPDoc documentation.

alt text

Was it helpful?

Solution

I've tried opening your project, and the completion seems to be working just fine for me.

The only thing I can think of is to try to delete your entire NB cache, which should be located in $HOME/.netbeans/$VERSION/var/cache/. This is a wild guess

Create a backup first, I didn't try this!

If that fails, maybe you should try creating a new project, maybe that will kick NB in the butt.

Note that in NB 7.2 beta, the cache has moved to $HOME/.cache/netbeans/$VERSION.

OTHER TIPS

What worked for me was deleting the old nbproject folder (that was created in windows) and recreating the PHP project from existing sources. This is on NB 7.0.1 Mac OS X. Clearing the cache did not work for me.

Be aware of @property something syntax. If object something does not exists in your code anymore, NetBeans might have problems with proper code completion. Consider example:

/** in main file: **/

use ABC as _ ;

/** in file ABC: **/

/** 
  *  @property \Something $something
  */

If you do not use $something anymore, NetBeans will most likely generate an exception, thus failing to complete the code.

What worked for me was clearing the cache, then explicitly including some key subdirectories in the Global include path. Appears that for some reason NB 6.7 wasn't recursing the directories.

Including at project level also worked Project->Properties->Include Path Netbeans 7.01 + Windows 7

If, for instance, you open a php file with netbeans without being part of a project, code completion doesn't work at all. What you need to do is to create a project having that file in it.

Tested this on NetBeans 7.0.1

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top