I asked a question and through the answer found I had not asked the right question!
Say LibraryFoo
is a library and if I use that elsewhere as a library, I get type completion. For example, if I have
/**
* Lorem ipsum
*
* @return {Object[]}
*
*/
function bar() {}
in LibraryFoo
and if in the other Google Script I type LibraryFoo.bar().
I get suggestions for an array like forEach
and map
. However, if instead I have
/**
* Lorem ipsum
*
* @return {Sheet}
*
*/
function barring() {}
and I type LibraryFoo.barring().
I do not get suggestions like getRange
or getMaxColumns
. I know that using clasp and local IDE might make more sense, but one of two seems to be the case:
Regardless, despite searching and trying different ways to namespace the Sheet
reference, I have not found out whether it is 1. or 2. (or something else!).
[EDIT: I have made a feature request to Google, still unsure which of 1./2./something else it is]
This is supported in the new editor, and an example of the syntax is as follows:
/**
* Returns price list data from the Stock tab/sheet
*
* @param {number} index
* @return {SpreadsheetApp.Range}
*
*/
function getRange() {
return SpreadsheetApp.getActiveRange();
}
function foo() {
getRange().
}
and you will get completion after the .
in getRange().
for a Range object.
This works as well if the function comes from a library.