Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JSDoc for showing optional arguments in Google Sheets autocomplete dropdown

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?

Google's autocomplete for WEEKDAY

/**
 * 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:

My custom function 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.

like image 541
ehfeng Avatar asked Jan 26 '19 23:01

ehfeng


1 Answers

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

like image 171
Niek Waarbroek Avatar answered Oct 15 '22 16:10

Niek Waarbroek