Search code examples
javascriptgoogle-apps-scriptautocompletelibrariesjsdoc

Is it possible to get the autocomplete functionality in AppsScript's script editor to work on custom classes?


If I construct a class in AppScript and add a method, is it possible to get the autocomplete feature to work when I type a period after an instance of that class?

Google's documentation says "If you want your library users to make use of Script Editor autocomplete and the automatically generated documentation, you must have JSDoc style documentation for all your functions."

I'm not sure if it's possible, or if I'm implementing the JSDoc style documentation incorrectly.

/*
* @constructor
*/
function MyConstructor(){
  this.sayHello = function(){
    return "Hello World!"
  }
}

function run(){
  var foo = new MyConstructor();
  //Is it possible to see autocomplete with "sayHello()" 
  //after typing this period
  var hello = foo.
}

Solution

  • Unfortunately jsdoc only works at the top function level in apps script, so methods declared with this.method = function() {} neither show up in the generated docs nor in autocomplete. It sucks, but there it is.

    You could join others in starring this this apps script issue

    But it's been open for almost 2 years now, and I don't see any movement on it.