Netbeans 6.9.1 中 php 的 vdoc 似乎不起作用

发布于 2024-10-10 14:56:19 字数 624 浏览 0 评论 0原文

当我插入 vdoc 时,如此处所述,Netbeans 不提供任何建议

/* @var $persistenceManager Tx_Extbase_Persistence_Manager */
$persistenceManager = t3lib_div::makeInstance('Tx_Extbase_Persistence_Manager');
$persistenceManager-> // no suggestions here

:变量名和类型没有改变结果。这是什么,我做错了什么还是只是一个错误?

我的 Netbeans 版本:

Product Version: NetBeans IDE 6.9.1 (Build 201011082200)
Java: 1.6.0_23; Java HotSpot(TM) Client VM 19.0-b09
System: Windows 7 version 6.1 running on x86; Cp1252; de_DE (nb)

When I insert a vdoc, like discriped here, Netbeans not offers any suggestions:

/* @var $persistenceManager Tx_Extbase_Persistence_Manager */
$persistenceManager = t3lib_div::makeInstance('Tx_Extbase_Persistence_Manager');
$persistenceManager-> // no suggestions here

The switch of variablename and type has not changed the result. What is it, what I'm making wrong or is it just a bug?

My Netbeans Version:

Product Version: NetBeans IDE 6.9.1 (Build 201011082200)
Java: 1.6.0_23; Java HotSpot(TM) Client VM 19.0-b09
System: Windows 7 version 6.1 running on x86; Cp1252; de_DE (nb)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

计㈡愣 2024-10-17 14:56:19

我想这在技术上并不是一个错误,但它就像蚊子在你耳边嗡嗡一样烦人。 :-)

代码模板从缩写的扩展可以通过一些事情来短路。例如,如果您开始键入缩写,犯了一个错误,按退格键删除并更正了几个字符而不是整个字符,那么 NetBeans 将不会检测到已键入模板的缩写,因此不会展开它。更常见的是,如果您输入的内容首先打开自动完成弹出窗口,那么代码模板的扩展也会停止。

当我尝试 vdoc 时,自动完成弹出窗口妨碍了我。很可能,这对你来说也是一样的。如果您使用扩展键输入得足够快,这样自动完成功能就不会弹出,那么它可能会起作用。

不幸的是,没有简单的开关或设置来控制自动完成显示的速度。幸运的是,有一种方法可以设置它。我从您的链接和对“vdoc”的兴趣假设您正在处理 PHP 文件,因此我们将为此设置自动完成延迟。

  • 打开 Windows 资源管理器并转到 %USERPROFILE%\.netbeans\config\Editors\text。 (%USERPROFILE% 可以直接输入到资源管理器路径栏中,就像它本身是路径一样,或者您可以转到 C:\Users\ -log-in-name 目录。)
  • 除非您已经有一个(我没有)创建一个名为 x-php5 的目录,
  • that 目录中创建名为 Preferences 的子目录
  • 目录中,创建一个名为:
    的文本文件
    org-netbeans-modules-editor-settings-CustomPreferences.xml
  • 使用文本编辑器打开该文件,然后输入以下内容:

    
    
    <编辑器首选项>
        <条目名称=“completion-auto-popup-delay”值=“3000”/>
    
    
  • 保存。

  • 停止并重新启动 NetBeans。
  • 尝试一下代码模板扩展。

completion-auto-popup-delay 以毫秒为单位设置,因此上面将其重置为三 (3) 秒显然太长了,没有什么用处。一旦代码完成扩展正常工作,请返回并编辑 XML 配置文件,并逐步减少延迟,直到您确信有足够的时间来键入和扩展代码模板,并且自动完成功能可以正常工作。弹出窗口不会花费过多的时间来做出反应。这将是一个平衡的行为。

我不知道是否确实需要这样做,但每次对 XML 文件进行更改时,我都会确保停止并重新启动 NetBeans。

另外

确保您在缩写后键入正确的扩展键。我将其更改为 SHIFT-Space 并且完全忘记了。

  • 在 NetBeans 中,单击“工具”,然后单击“选项”
  • 在“选项”对话框中,单击工具栏中的“编辑器”图标
  • 单击“代码模板” 选项卡
  • 检查(如有必要,更改)扩展模板设置

    alt text

I suppose it is not technically a bug, but it is just as annoying as a mosquito buzzing in your ear. :-)

The expansion of code templates from their abbreviations can be short-circuited by a few things. For example, if you start to type the abbreviation, make a mistake, backspace to erase and correct just a few characters but not the whole thing, then NetBeans won't detect that the abbreviation for the template was typed, and thus won't expand it. A little more commonly, if what you type opens up the auto-completion pop-up first, then the expansion of code templates is also stopped.

When I tried out vdoc, the auto-completion pop-up got in the way for me. Likely, it is the same for you. If you type it quickly enough with the expansion key so that the auto-completion does not pop-up, it will probably work.

Unfortunately, there is no easy switch or setting to control how quickly auto-completion shows up. Fortunately, there is a way to set it. I am assuming from your link and interest in "vdoc" that you are working on PHP files, so we'll set the auto-completion delay for that.

  • Open windows explorer and go to %USERPROFILE%\.netbeans\config\Editors\text. (%USERPROFILE% can be typed directly into the explorer path bar just like it was a path itself, or you can go to the C:\Users\your-log-in-name directory.)
  • Unless you already have one (I didn't) create a directory called x-php5
  • Inside that directory, create a sub-directory called Preferences
  • Inside that directory, create a text file named:
    org-netbeans-modules-editor-settings-CustomPreferences.xml
  • Open that file with a text editor, and put in the following:

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE editor-preferences PUBLIC "-//NetBeans//DTD Editor Preferences 1.0//EN" "http://www.netbeans.org/dtds/EditorPreferences-1_0.dtd">
    <editor-preferences>
        <entry name="completion-auto-popup-delay" value="3000" />
    </editor-preferences>
    
  • Save it.

  • Stop and restart your NetBeans.
  • Give code template expansion a try.

The completion-auto-popup-delay is set in milliseconds, so the above resets it to three (3) seconds. That is obviously too long to be useful. Once you get the code completion expansion working properly, go back in and edit the XML configuration file, and reduce the delay in increments until you are comfortable that you have both enough time to type and expand a code template, and that your auto-completion pop-up doesn't take an inordinate amount of time to react. It will be a balancing act.

I don't know if it is strictly needed, but I made sure to stop and re-start NetBeans each time I made a change to the XML file.

Also:

Make sure you are typing the correct expansion key(s) after the abbreviation. I changed mine to SHIFT-Space and forgot all about it.

  • In NetBeans, Click on Tools then Options
  • In the Options dialog, click on the Editor icon in the toolbar
  • Click on the Code Templates tab
  • Check (and if necessary, change) the Expand Template on setting

    alt text

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文