相关疑难解决方法(0)

如何在Google Apps jsdoc说明中强制换行

我无法弄清楚Google Apps脚本中如何正确显示这一点.我需要它在jsdoc输出中显示新行(例如,当函数工具提示窗口出现在Spreadheet函数中时.)我尝试过html,
但它只是呈现为文本而不是换行符.

例如:

/**
 * Converts the prefixed value to the specified base.
 * Requires one of the following prefixes: 
 *    '0b' Base 2:   binary 
 *    '0q' Base 4:   quaternary 
 *    '0o' Base 8:   octal
 *    '0x' Base 16:  hexadecimal
 *
 * @param {string} Value The prefixed value to convert.
 * @param {number} To The base to convert to.
 * @return The converted base.
 * @customfunction
 */
function BASEP(Value, To) {
Run Code Online (Sandbox Code Playgroud)

这只是呈现一个文本blob:

Summary:
  Converts the prefixed value to the …
Run Code Online (Sandbox Code Playgroud)

google-docs google-sheets jsdoc google-apps-script

10
推荐指数
5
解决办法
7675
查看次数

Google Apps脚本自动生成的库文档

我目前正在开发Google Apps脚本库,该库基本上将电子表格视为数据库对象。

当前,该库具有两个相同的功能,例如

/**
* Opens and creates a query object for a spreadsheet with the given url.
*
* @param {String} the url of the spreadsheet
* @return {SpreadsheetQuery_} a spreadsheet query object for the given spreadsheet
*/
function openByUrl(url) {
    return new SpreadsheetQuery_(SpreadsheetApp.openByUrl(url));
}
Run Code Online (Sandbox Code Playgroud)

现在,对于这两个公共函数,生成的文档仅显示返回类型,而不显示参数或附带的说明。我假设这是一个Google问题,并没有真正打扰。

但是我的主要问题是,由于函数正在从私有函数实例化对象,因此如何获取自动文档以显示该对象上存在的方法。所有功能都将由对象提供,如果GAS可以在其上显示方法,那就太好了。

注意


这些方法都放在函数的原型上。例如。

SpreadsheetQuery_.prototype.from =函数(工作表){
    如果(_.isNumeric(sheet)){
        ....
}

谢谢。

documentation shared-libraries code-documentation intellisense-documentati google-apps-script

3
推荐指数
1
解决办法
1342
查看次数

如何在 Google 脚本库中输入提示 Google Types?

我问了一个问题,通过答案发现我没有问正确的问题!

SayLibraryFoo是一个库,如果我在其他地方使用它作为库,我会得到类型完成。例如,如果我有

/**
 *  Lorem ipsum
 *
 *  @return {Object[]}
 *
 */
function bar() {}
Run Code Online (Sandbox Code Playgroud)

in LibraryFooand if 在我输入的另一个 Google 脚本中,我得到了像and 这样LibraryFoo.bar().的数组的建议。但是,如果我有forEachmap

/**
 *  Lorem ipsum
 *
 *  @return {Sheet}
 *
 */
function barring() {}
Run Code Online (Sandbox Code Playgroud)

我输入时LibraryFoo.barring().没有得到类似getRange或 的建议getMaxColumns。我知道使用扣环和本地 IDE 可能更有意义,但以下两种情况之一似乎是这样:

  1. 我使用了错误的名称/引用(尽管当输入 Google 自己的函数时,它们只是说“Sheet”。例如 SpreadsheetApp 的源代码是否可用?这可能是一个提示,或者不在正确的 GAS 中)。
  2. 这是不可能的,因为谷歌已经做了一些我/我们做不到的事情。

无论如何,尽管搜索并尝试了不同的方法来命名引用Sheet,但我还没有发现它是 1. 还是 2.(或其他东西!)。

[编辑:我已经向 Google 提出了功能请求,但仍然不确定它是 1./2./其他中的哪一个]

libraries jsdoc google-apps-script

3
推荐指数
1
解决办法
1236
查看次数