最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - GoogleAppsScript - Autocompletion within Webstorm? - Stack Overflow

programmeradmin4浏览0评论

Is there a way to get autopletion for Google Apps Script in Webstorm or any Jetbrains IDE?

I have read, that it's possible for ecplise.

Can i get the GAS library somehow into Webstorm? Or what exactly would I have to do, to get the autopletion to work? :)

Is there a way to get autopletion for Google Apps Script in Webstorm or any Jetbrains IDE?

I have read, that it's possible for ecplise.

Can i get the GAS library somehow into Webstorm? Or what exactly would I have to do, to get the autopletion to work? :)

Share Improve this question asked Feb 6, 2016 at 19:19 JohnRWJohnRW 7787 silver badges23 bronze badges
Add a ment  | 

4 Answers 4

Reset to default 6

A similar question you can refer to:
How do I use WebStorm for Chrome Extension Development?, the only difference to the referred answer is in step 5, try to search for google-apps-script (instead of chrome).

Install the library and open gs files as JavaScript.

Then you are going to have grammar highlighting and autopletion.

How about using TypeScript instead of pure JavaScript?

Definition file for GAS is available here. https://github./DefinitelyTyped/DefinitelyTyped/pull/6723

I haven't tried it yet but I'm planning to try it. I've just started using GAS and am exploring GAS now.

P.S In order to code GAS, this article may be helpful. http://googleappsdeveloper.blogspot.jp/2015/12/advanced-development-process-with-apps.html

WebStorm (and any JetBrains IDE with the JavaScript plugin) can now handle this automatically by using TypeScript munity stubs. The details are in Configuring JavaScript Libraries - Help - WebStorm.

Follow the instructions on that page under To download TypeScript definitions in the Settings/Preferences dialog. Search for the TypeScript munity stub named google-apps-script.

WebStorm will try to guess the type of variables based on the context, but you can also tell it explicitly. For example this tells WebStorm that thread is a GmailThread. So getLabels could be autopleted.

/**
 * @param {GoogleAppsScript.Gmail.GmailThread} thread
 */
function getThreadInfo(thread) {
  thread.getLabels()
}

FYI, You can search for TypeScript munity stubs and get more information on each one at https://microsoft.github.io/TypeSearch/.

I've looked around as well but haven't found anything yet. I don't think so, but I could be wrong. In order to get it to work, you could reverse engineer the Eclipse plugin, which I'm guessing won't be straightforward.

发布评论

评论列表(0)

  1. 暂无评论