Eclipse PDT和自定义PHPDoc注释 [英] Eclipse PDT and custom PHPDoc annotations

查看:110
本文介绍了Eclipse PDT和自定义PHPDoc注释的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有办法为Eclipse PDT添加自定义phpdoc注释?
例如,我想在自动填充列表中查看 @depends (对于PHPUnit),但现在我可以看到只有标准注释(例如, @deprecated )。



提前感谢





所以我猜想添加一个新的内容辅助上下文的真正的方式是扩展Eclipse。 p>

替代方法:使用模板



另一种获取注释的方法是添加他们通过模板。请执行以下步骤:




  • 转到窗口>首选项> PHP>编辑器>模板。

  • 单击新建,填写对话框并确认所有内容以返回到您的编辑器





现在设置模板在PHP注释的上下文中出现。转到UnitTest DocBlock并键入 @ 。如果Content Assist没有自动打开,请点击 Ctrl + 空格。应该有一个选项来选择 @depends





确认您将确认任何其他建议。这应该写 @depends ,并将光标放在它旁边(所以你可以插入测试的名称)。


Is there any way to add custom phpdoc annotation for Eclipse PDT? For example, I want to see @depends (for PHPUnit) in autocomplete list for comments, but now I can see there only standard annotations (for example, @deprecated) .

Thanks in advance.

解决方案

I assumed there would be a configuration file somewhere, but looking through the various folders in my Zend Studio installation didnt give me the results I was hoping for. Searching Eclipse.org for Content Assist yielded

So I guess the "real" way to add a new Content Assist Context would be to extend Eclipse.

Alternative: Using Templates

The other way to get the annotations would be to add them via Templates. Follow these steps:

  • Go to Window > Preferences > PHP > Editor > Templates.
  • Click New, fill in the dialogue and confirm everything to get back to your editor

The template is now setup to appear when in the context of a PHP Comment. Go to a UnitTest DocBlock and type @. If Content Assist does not open automatically, hit Ctrl+Space. There should be an option to select @depends now.

Confirm as you would confirm any other suggestion. This should write @depends and put your cursor right next to it (so you can insert the name of the test).

这篇关于Eclipse PDT和自定义PHPDoc注释的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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