是否可以在AppsScript的脚本编辑器中获得自动完成功能来处理自定义类? [英] Is it possible to get the autocomplete functionality in AppsScript's script editor to work on custom classes?

查看:89
本文介绍了是否可以在AppsScript的脚本编辑器中获得自动完成功能来处理自定义类?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在AppScript中构造一个类并添加一个方法,当我在该类的实例之后键入句点时,是否可以使自动完成功能起作用?

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的文档表示如果您希望您的图书馆用户使用脚本编辑器自动完成和自动生成的文档,您必须具有所有功能的JSDoc样式文档."

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."

我不确定是否可行,或者我是否正确实施了JSDoc样式文档.

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.
}

推荐答案

不幸的是jsdoc仅在应用程序脚本中的顶级功能级别上起作用,因此使用this.method = function(){}声明的方法均未显示在生成的文档中也不是自动完成.很烂,但确实有.

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

但是它已经开放了将近2年,我看不到有任何动静.

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

这篇关于是否可以在AppsScript的脚本编辑器中获得自动完成功能来处理自定义类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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