26

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

3
  • Can you provide a complete code+PHPDoc sample so we can try it out? May 16, 2009 at 22:20
  • I'm using Netbeans 6.5 on Mac and it autocompletes for all of my code and classes - could it exclusively a 6.7 Beta thing?
    – karim79
    May 16, 2009 at 23:15
  • Afraid not, 6.1 and 6.5 did exactly the same, only looking slightly less attractive doing it.
    – Kris
    May 17, 2009 at 1:06

5 Answers 5

42

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.

11
  • 2
    I was really hesistant to try this, but it did actually fix the problem. (rm -rf'ing the cache)
    – Kris
    May 17, 2009 at 16:04
  • Kewl, now I know what to do if this ever happens to me :) Strange that it happened at all... May 17, 2009 at 17:59
  • 1
    had some odd issues with code completion in NB6.8 for python. Clearing the cache solved my problems.
    – David
    Jan 16, 2010 at 15:54
  • 1
    Worked beautifully with 7.2 when my "hints" suddenly went away. On Linux I did cd ~/.cache/netbeans/ ; tar cvfz backup.tgz ./7.2.1; rm -rf 7.2.1. My project is rather large so I had to wait about 10-12 minutes for the background scan to complete, but once it finished the previously missing auto-complete was back in action! Thanks! Mar 7, 2013 at 19:21
  • 1
    @JeyKeu: Sorry mate, no idea, I'm still on 10.10... Could it be a packaging issue? Have you tried a non-repo version (or vice versa if it is a repo version)? May 19, 2014 at 12:03
2

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.

1
  • I haven't run into the same problem since netbeans 7.0 (though code completion can still be flaky from time to time)
    – Kris
    Aug 31, 2011 at 6:24
2

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.

2

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

1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.