JSDoc for showing optional arguments in Google She

2020-04-08 13:53发布

问题:

I'd like to document (in the Google Sheet autocomplete) a custom function with optional arguments, similar to the WEEKDAY function (autocomplete below).

The JSDoc spec on optional arguments does not work. Google does not seem to document this anywhere. How can I create a function with the same visual treatment (both in the argument description and the Example) that Google has?

/**
 * Summary of function
 * @param {"example"} arg Argument description
 * @param {"optional"} opt_arg This argument is optional
 * @return {String} Return value description
 * @customfunction
 */
function JSDOC(arg, opt_arg) {
  return
}

Generates this autocomplete:

This is not a duplicate. I'm specifically asking about optional arguments, as you can see, I've successfully gotten the autocomplete's other features working.

回答1:

Google Apps Script doesn't support optional params in their JSDoc at this moment.