Netbeans 7.2 autocomplete for namespace class

做~自己de王妃 提交于 2019-12-23 05:23:51

问题


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


Does not work for namespaced class


回答1:


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!


来源:https://stackoverflow.com/questions/14397895/netbeans-7-2-autocomplete-for-namespace-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!