Google表格自定义函数支持多少数量的JsDoc? [英] What amount of JsDoc is supported in Google Sheets custom functions?

查看:138
本文介绍了Google表格自定义函数支持多少数量的JsDoc?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Google暗示支持JsDoc:

Google implies that JsDoc is supported:


如果自定义函数的脚本包括
JsDoc @,则该列表中将显示自定义函数customfunction标记,如下面的DOUBLE()示例中所示。

Custom functions will appear in this list if their script includes a JsDoc @customfunction tag, as in the DOUBLE() example below.

https://developers.google.com/apps-script/guides/sheets/functions

但是似乎并没有完全支持JsDoc,而且我找不到显示支持哪些内容的文档。

But it doesn't seem that JsDoc is supported in full, and I can't find the documentation that shows what is supported and not.

I我特别在寻找一种用于记录自定义函数的参数是可选的的方法。像这样,对于value2:

I'm particularly looking for a way to document that a parameter for a custom function is optional. Like this, for value2:

< img src = https://i.stack.imgur.com/1SNYD.png alt =在此处输入图片描述>

图片提供:的: https://yagisanatode.com/2018/08/24/google-apps-script-how-to-make-a-custom-function-to-use-in-google-sheets/

使用JsDoc,您应该能够基于此源执行以下操作:
https://jsdoc.app/tags-param.html#optional-parameters-and-default-values

Using JsDoc, you should be able to do the following, based on this source: https://jsdoc.app/tags-param.html#optional-parameters-and-default-values

/**
 * @param {number} [value2] - Additional numbers or ranges to add to value1.
 */

并且,默认值为:

/**
 * @param {number} [value2=100] - Additional numbers or ranges to add to value1.
 */

但是我在Google表格中对此进行了测试,但均无效果。甚至没有建议的Google Closure Compiler语法(在可行的情况下):

But I tested this in Google sheets, and none of this works. Not even the suggested Google Closure Compiler syntax (in case that should work):

/**
 * @param {number=} value2 - Additional numbers or ranges to add to value1.
 */

当前,我求助于不太优雅的地方:

Currently I have resorted to the less elegant:

/**
 * @param {number} value2 - [OPTIONAL] Additional numbers or ranges to add to value1.
 */

因此,在哪里可以找到有关支持JsDoc哪个部分的文档在Google表格中显示?

So, where can I find the documentation over what part of JsDoc is supported in Google Sheets?

奖励积分,如果您可以使用JsDoc展示一种记录可选参数的方法,该方法可以从屏幕截图中获得所需的结果(这比我目前的拙劣要好)解决方案)。

Bonus points if you can show a way to document the optional parameter using JsDoc that achieves the desired result from the screenshot (which is better than my current inelegant solution).

推荐答案

JsDoc可选参数功能似乎不受Sheets自定义功能的支持,但没有官方文档可以为此找到的。

JsDoc optional arguments feature doesn't seem to be supported for Sheets custom functions, but no official documentation can be found for this.

我建议您在该组件以请求该功能,或者至少更详细地记录支持的功能。

I'd suggest you to file a Feature Request in this component to ask for this functionality, or at least to document in more detail what functionality is supported.

与此相关的功能请求由OP在问题跟踪器中提交:

A Feature Request regarding this was submitted in Issue Tracker by OP:

  • Issue #156230902: The level of JsDoc support is not documented (for Sheets custom functions)

任何想要跟踪此事的人都可以单击引用页面左上角的星号。

Anyone who want to keep track of this can click the star on the top left on the referenced page.

这篇关于Google表格自定义函数支持多少数量的JsDoc?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆