PHPDoc and JSDoc auto documenting

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.

Recent Posts

Scroll to Top