Domanda

Edit: Bug reported, accepted and patched http://netbeans.org/bugzilla/show_bug.cgi?id=225062

Since a day or two my Netbeans IDE stopped hinting class arguments and autocompletion does not work for namespaced classes, and I'm simply wondering what I might have done to break the autocompletion/hinting - or if this is a known bug. This reproduces on Ubuntu 12.10 and Windows 7 using Netbeans 7.2 and also with Netbeans 7.3 beta 2.

This would be strange if it is a known bug because I'm almost certain it was working a couple of days ago.

Scenario;
Class HostNameRoute exists within the Router\Route namespace, the constructor takes two arguments $route and $action.

namespace Router\Route;
class HostNameRoute {}

From the root namespace I used to be able to get hints and autocomplete by typing:

new HostNam[Ctrl+Space]  ::  Suggests HostNameRoute($route, $action)  :: [Enter]

Would produce
new \Router\Route\HostNameRoute(<$route>, <$action>);

But now the IDE just hints the qualified name but does not show argument documentation nor does it autocomplete. It does however spawn a static strange box over the class name (not interactive).

However, the hinting and autocompletion still works for classes in the root namespace:

new Te[Ctrl+Space]  :: Suggests Test($arg) :: [Enter]

Produces
new Test(<$arg>);

Works for root namespace
Autocomplete works


Does not work for namespaced class No autocomplete

È stato utile?

Soluzione

I just had a similar issue where Netbeans stopped autocompleting within a specific project (other projects were working fine). I am running Netbeans 7.2.1 on Windows 7. I am also using namespaces and use statements. When trying to use autocomplete, Netbeans was just giving me variable names declared in the same method. Using the this keyword within a class wouldn't even give me variables/methods in that class.

Here is what I did to fix it:

  1. Went to the "Project" window and right clicked on my project and hit close
  2. Closed Netbeans
  3. Deleted Netbeans' cache. This can be found at C:\Users\ProfileName\AppData\Local\NetBeans\Cache\7.2.1 on a Windows machine.
  4. Opened Netbeans
  5. Added my code back as a project by going to File->New Project...
  6. Checked autocomplete and it worked!
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top