问题描述
我正在开始使用Google Apps脚本,并且发现自动完成功能非常有用.但是,一旦进入新函数,自动完成功能似乎就无法知道参数的类型.我已经看到了一些有关python想法的答案,这些想法都说使用javadoc可以起作用.但我无法弄清楚.有什么建议吗?
I'm getting started with Google Apps scripting, and find the autocomplete very useful. However, once you are inside a new function, autocomplete doesn't seem to have any way of knowing what the type is for the parameter. I've seen some answers about python ideas that say that using javadoc will work. But I'm not able to figure it out. Any suggestions?
function myfunc1(){
var activeSheet=SpreadsheetApp.getActiveSheet();
activeSheet//.autocomplete works here
myfunc2(activeSheet)
}
function myfunc2(myActiveSheet){
myActiveSheet//.autocomplete doesn't work here
}
推荐答案
就自动完成而言,UI的功能有局限性.
There are limitations to what the UI can do in terms of autocomplete.
通常,我只是在另一个选项卡中打开参考文档并进行引用,但是您也可以使用注释来诱使UI自动完成:
Usually I just keep the reference documentation open in another tab and refer to that, but you can also trick the UI into auto completing using comments:
function myfunc2(myActiveSheet){
/*
var myActiveSheet = SpreadsheetApp.getActiveSheet()
*/
myActiveSheet //.autocomplete now works here
}
这篇关于Google Apps脚本编辑器中的自动完成功能并不总是知道类型/上下文的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!