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

Tech Debt Best Practices: Minimizing Opportunity Cost & Security Risk

Tech debt is an unavoidable consequence of modern application development, leading to security and performance concerns as older open-source codebases become more vulnerable and outdated. Unfortunately, the opportunity cost of an upgrade often means organizations are left to manage growing risk the best they can. But it doesn’t have to be this way.

Read More
Scroll to Top