NetBeans code template for using all the arguments declared in the function's header

Viewed 759

Is it possible to write a NetBeans code template for using all the arguments declared in a function's header (e.g. for calling another function with these variables)? The number of the arguments can be different, so it doesn't seem to be easy.

For example, sometimes I want to print out all the arguments in a function for debugging purposes.


Here's an example usage (calling dsm() function multiple times depending on the number of the arguments):

function testModule_theme($existing, $type, $theme, $path) {
  dsm($existing, '$existing in ' . __FUNCTION__ . '()');
  dsm($type, '$type in ' . __FUNCTION__ . '()');
  dsm($theme, '$theme in ' . __FUNCTION__ . '()');
  dsm($path, '$path in ' . __FUNCTION__ . '()');

  return array(
    // ......
  );
}

Here's another one:

function testModule_block_view($delta = '') {
  dsm($delta, '$delta in ' . __FUNCTION__ . '()');
  $block = array();
  // .....
  return $block;
}

As you can see, there are 4 arguments in the first case, and only 1 in the second. The name of the arguments is also changing depending on the given function.

There's a code template I already wrote for using dsm() function:

ddsm code template

dsm($$${VARIABLE newVarName default="variables"}, '$$${VARIABLE} in '.__FUNCTION__.'()');

this way I just type ddsm, hit Tab, and then I have to type the exact name of the variable. So it would print out the following:

dsm($variables, '$variables in ' . __FUNCTION__ . '()');

After that, I can change the variables part, and type another name, and the same would be used in the string. An example:

Using ddsm code template

But I'm still too laggard to type that stuff :D, and I'm curious if there is a way to use all the arguments of a given function when using a code template in NetBeans.

2 Answers
Related