命名空间类的Netbeans 7.2自动完成 [英] Netbeans 7.2 autocomplete for namespace class

查看:90
本文介绍了命名空间类的Netbeans 7.2自动完成的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

错误已报告,已接受并已修补 http: //netbeans.org/bugzilla/show_bug.cgi?id=225062

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

一两天以来,我的Netbeans IDE停止提示类参数,并且自动补全不适用于命名空间类,我只是想知道我可能会做些什么来打破自动补全/提示-或这是否是已知的错误.此代码在使用Netbeans 7.2的Ubuntu 12.10和Windows 7以及Netbeans 7.3 beta 2上复制.

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.

场景;
Router \ Route 名称空间中存在类 HostNameRoute ,构造函数使用两个参数 $ route $ action .

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>);

但是现在IDE仅提示限定名称,但不显示参数文档,也不会自动完成.但是,它确实在类名称上生成了一个静态的奇怪框(非交互式).

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

不适用于命名空间类

推荐答案

我有一个类似的问题,即Netbeans停止了在特定项目中进行自动填充(其他项目运行正常).我在Windows 7上运行Netbeans 7.2.1.我也在使用名称空间和use语句.当尝试使用自动完成功能时,Netbeans只是给了我用同一方法声明的变量名.在一个类中使用 this 关键字甚至都不会给我该类中的变量/方法.

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.

这是我要解决的问题:

  1. 转到项目"窗口,右键单击我的项目,然后单击关闭
  2. 封闭式Netbeans
  3. 已删除Netbeans的缓存.可以在Windows计算机上的C:\ Users \ ProfileName \ AppData \ Local \ NetBeans \ Cache \ 7.2.1中找到.
  4. 打开Netbeans
  5. 转到文件->新建项目...
  6. ,将我的代码添加回项目中
  7. 检查了自动完成功能,它起作用了!
  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!

这篇关于命名空间类的Netbeans 7.2自动完成的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆