Eclipse PDT and PHPDoc custom annotations

Can I add custom phpdoc annotation for Eclipse PDT? For example, I want to see @depends (for PHPUnit) in the autocomplete list for comments, but now I see only standard annotations (e.g. @deprecated ).

Thanks in advance.

+7
source share
1 answer

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

So, I think the β€œreal” way to add a new Content Assist Context is to extend Eclipse.

Alternative: using templates

Another way to get annotations is to add them via Templates. Follow these steps:

  • Go to window> Settings> PHP> Editor> Templates.
  • Click "Create", fill out the dialog and confirm everything to return to your editor.

enter image description here

Now the template is configured when in the context of a PHP comment. Go to UnitTest DocBlock and type @ . If Content Assist does not open automatically, press Ctrl + Space . Now you need to select @depends .

enter image description here

Confirm how you confirm any other offer. This should write @depends and place the cursor right next to it (so you can insert a test name).

+14
source

All Articles