Published: February 13, 2009Last Updated: June 28, 2019

PHPDoc and JSDoc auto documenting

Nathan Rijksen has recently posted a neat Komodo macro that I’ve found very useful when editing PHP and JavaScript files:

https://community.activestate.com/forum/phpdoc-autocompletion

What Nathan’s macro does is when you have a function/class/variable already defined in your code and are wanting to add documentation comments (PHPDoc or JSDoc style) then you start typing “/**” and press ENTER. At this point Nathan’s trigger macro will kick in and try to auto-document the information using the next code line.

Here is an example:

<?php

/**[cursor]

function DocMe(arg1, arg2, foo=1) {

?>

the result after pressing [ENTER] is:

<?php

/**

* Summary[cursor]

* @param Type arg1 – Description

* @param Type arg2 – Description

* @param Type foo – Description

*/

function DocMe(arg1, arg2, foo) {

?>

The inserted text even makes use of tabstops so you can easily tab between the arguments, neat! Thanks for the great macro Nathan.

Cheers,

Todd

Title photo courtesy of Bernd Klutsch on Unsplash.

Todd Whiteman

Todd Whiteman

Todd Whiteman is the Development Lead for Komodo IDE. He works adeptly with Mozilla, Python and JavaScript to ensure that Komodo IDE is the IDE of choice for development teams. Todd has been working on Komodo IDE for nearly 6 years, adding components such as the Vi Key Bindings, Distributed Source Code Control, 64-bit Linux builds as well as Remote SSH support into Komodo IDE.