X

An Oracle blog about NetBeans for PHP

Code Completion for PHPDoc Tags

Guest Author

We've just added code completion for PHPDoc tags. It pops up automatically when the user types '@' inside a PHPDoc comment. There are many areas to improve, in the future we are going to be more intelligent about the parameters for the commonly used tasks.

One neat feature that it already implemented is showing tag documentation including example of use:

 Screenshot: Code Completion for PHPDoc tags


Join the discussion

Comments ( 13 )
  • Anton Heryanto Hasan Friday, June 13, 2008

    wow great, thanks...

    wanna ask, is it this improvement will be in PHP plugin update or will available in future version (nb 6.5)

    thanks


  • Petr Pisl Saturday, June 14, 2008

    This is a part of 6.5 build. You can download the php ide as result of continual build of trunk at http://deadlock.netbeans.org/hudson/job/trunk/lastSuccessfulBuild/artifact/nbbuild/dist/zip/. There you can also download all in one version.


  • Marius Kubatz Friday, June 20, 2008

    hey sounds great,

    can I have code completion for method calls, pls?

    ( $object -> getValue() )


  • Petr Pisl Friday, June 20, 2008

    Code completion for method works in some cases. The file has to be in a project and the file with the class has to be included or required in the edited file. We are working to work without these conditions. Correct me Tomasz, if I'm wrong.


  • Marius Kubatz Friday, June 20, 2008

    Ahh, thank you!

    I have found out why it won't work in my project:

    Server variables are not translated into paths., document root points to /var/www/

    define("_SYSPATH",$_SERVER['DOCUMENT_ROOT']."system/");

    include(_SYSPATH.'core/entity/Object.class.php');

    $entity = new Object();

    $entity-> no code completion here,

    It works only with absolute paths, or relative paths...


  • Kevin Bond Friday, August 8, 2008

    Hi,

    Great work on the project! I am currently using Zend Studio and this looks loads better already!

    I had a question about phpDocs. Will you be able to auto generate them for say a function or variable. I really like this function in Zend Studio. You can just select a funtion and click a button and the phpDoc block with @var('s) is created for you above the function.

    I am reluctantly starting to get in the habit of commenting my work so any shortcuts are good.

    Regards,

    Kevin


  • Petr Friday, August 8, 2008

    Hi Kevin,

    in NetBeans there is not exactly the same functionality as you described. But there is something similar.

    Just write "/\*\*" and press enter on a line before a function, class or field decalration. NetBeans will automatically generate stab of the PHPDoc for you.

    For example on line 11 function declaration starts:

    public function setNick($nick) {

    ...

    When you write at line 10 /\*\* and press enter, then NetBeans generates

    /\*\*

    \*

    \* @param <type> $nick

    \*/

    public function setNick($nick)

    Does it fits what you need? Thanks,

    Petr


  • Kevin Bond Monday, August 11, 2008

    Thanks Petr,

    That is exactly what I was looking for!

    -Kevin


  • Daniel Thursday, March 5, 2009

    Hi sorry this is very late to the post, but how can i add some new @tagname to include by default when using the /\*\* above the function as per Petr's Post.


  • Miguel Cudaihl Friday, February 12, 2010

    Just started using Netbeans and this is exactly what I'm looking for. I've been manually commenting my work for a while.

    Thanks


  • Tomas Thursday, April 8, 2010

    I using netbeans 6.8 and for me auto completion don't work. If i write "/\*\*" before my function etc and press Enter i get

    "/\*\*

    \*

    \*/"

    How to fix it ?


  • Andreas Thursday, April 22, 2010

    My auto completion stopped working, too. If you type "/\*\*" before a coded class you get an empty: "/\*\*

    \*

    \*/"

    When you type "/\*\*" before interfaces or functions you will get an open comment:

    "/\*\*

    \*"

    This worked in Netbeans 6.7 Is this a degression through a recent update?

    The PHP Doc hints/tool tips from older entries still work...


  • guest Sunday, July 3, 2011

    Just type / * * (without the spaces)

    (You do not need to escape the * anymore)


Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.