-
Notifications
You must be signed in to change notification settings - Fork 417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IDE support? (IntelliJ, VS Code) #10
Comments
If you can add JS support to .GS files, then you should have support for Apps Script files (just don't use ES6 features). |
I haven't tried it, but I'd be interested to see the IntelliJ support with Apps Script. It would be great if you could see autocomplete bindings like the script.google.com editor. (I can try to open-source the services/bindings). Let me know if you have used IntelliJ with Apps Script, could be a much-improved developer experience. 😄 |
I did add .GS as a file type for Javascript, and set the language version to avoid ES6 features, but as you said, the really important thing would be a plugin that would provide autocomplete for the App Scripts APIs |
I'm working on typescript + Apps Script. It works really well with autocompletion, linting, etc. Working on updating the Apps Script dts files right now. @motemen created a library that can generate them (https://github.com/motemen/dts-google-apps-script). I'll try to update the bindings and then write a tutorial for how you can actually develop Apps Script outside of the online editor. Looking promising right now! |
@grant would you consider saving |
@jondcallahan We could save as Feel free to send a PR for the |
We should probably leave this issue open and document how to actually use an IDE with Apps Script. (Hint: It's incredible, autocomplete galore, TypeScript + Apps Script!) |
Would love to have up-to-date (including Gmail Add-on) typescript files definitions. |
This is mostly up to date, save for I think you mentioned writing a blog post about using TS with apps script @grant , if so how is that coming along? I'm thinking of migrating an existing project over to TS but there wasn't too much written about configuring the tooling. Would love to have a canonical guide from you/your team. |
Current ProgressI have a few PRs out:
I have access to a big JSON document (96,000 lines) that used for the Apps Script editor's autocompletion. If someone wants to build a {
"parentType": {
"name": "SlidesApp",
"fields": [
...
{
"name": "ColorType",
"typeName": "SlidesApp.ColorType",
"kind": "NORMAL",
"description": "An enumeration of color types."
},
...
{
"name": "VideoSourceType",
"typeName": "SlidesApp.VideoSourceType",
"kind": "NORMAL",
"description": "An enumeration of the types of video source."
}
],
"methods": [
{
"name": "create",
"returnTypeName": "SlidesApp.Presentation",
"params": [
{
"name": "name",
"typeName": "String",
"description": "The name to be given to the created presentation."
}
],
"description": "Creates and opens a new \u003ccode\u003e\u003ca target='_blank' href='https://developers.google.com/apps-script/reference/slides/presentation.html'\u003ePresentation\u003c/a\u003e\u003c/code\u003e.",
"returnDescription": "the presentation with the given name."
},
{
"name": "getActivePresentation",
"returnTypeName": "SlidesApp.Presentation",
"description": "Returns the currently active presentation to which the script is \u003ca\n href=\"/apps-script/scripts_containers\"\u003econtainer-bound\u003c/a\u003e, or \u003ccode\u003enull\u003c/code\u003e if there is no\n active presentation. To interact with a presentation to which the script is not\n container-bound, use \u003ccode\u003e\u003ca target='_blank' href='https://developers.google.com/apps-script/reference/slides/slides-app.html#openById(String)'\u003eopenById(id)\u003c/a\u003e\u003c/code\u003e instead.\n\n \u003cpre class=\"prettyprint\"\u003e\n // Get the current presentation to which this script is bound.\n var presentation = SlidesApp.getActivePresentation();\n \u003c/pre\u003e\n\n If the presentation is already open, the same presentation instance is returned."
},
... TodayYou can use TS + GAS today, just Next Steps
Help is welcome. |
@grant For a while now I'm using this library https://github.com/JeanRemiDelteil/gas-lib that also comes as an NPM package. This package is auto-generated from the kind of files you just linked as example, however it does not generate typescript for now, but javascript JsDoc. I figure it would not be to difficult to generate typescript since the JSON parser is already done and working. I will try to dip my hands in this and clean the generator code while I'm at it, so I can publish it here. @deinspanjer By the way, I'm currently working with webstorm on AppsScript projects. |
FYI: This will be documented and solved in It's a bit complicated to explain, but basically, you'll rename files from js to ts if you want type support locally, or want to use es6. |
(FYI: I've renamed this to |
@grant I've invited you to access my repo for generating GAS stubs / d.ts files. |
Thanks for the ping. Are there specific things missing from using TypeScript today? If so, I can help make those changes. I think the definitions are complete. |
I have to make some tests, but some code are giving errors when it should not.
gives the error (i'm using "Jetbrains Webstorms" == "Intellij for JS"):
on Maps.DirectionFinder.Avoid.HIGHWAYS Also these typing should be up-to-date when there are changes in GAS, not every years, in fact, it should be the gas team that should generate and provide those ! If we can use those typing without issues, then I will be more than happy to switch ! That would be awesome. |
https://github.com/google/clasp/blob/master/docs/typescript.md The GAS team can't provide better I'm going to close this original issue of creating IDE support. If there are issues with the new support, we can create a new GitHub issue with specific details. |
still not sure if IntelliJ can work with the current state. See my latest report at #268 Basically IntelliJ wants to create an import like this: I ve tried using: import "google-apps-script" I just installed the types via NPM as normal. |
I'll continue the conversation with that issue. I should mention you cannot use the I haven't tried IntelliJ, only VSC. I'll investigate more during the week. |
@grant I've started building a d.ts generator to solve our own needs, so it can generate dts files from https://github.com/maelcaldas/clasp-types It works by writing and reading a JSON model from Typedoc engine, so, its only for libraries already written in Typescript. Some questions:
clasp --library-types To generate d.ts for libraries and clasp --client-types To generate d.ts for client-side api If JSDoc engine also supported, once classes properly annotated with Happy to have your thoughts on that and possibly collaborate on shipping it on clasp, if that make sense. |
Are any of you working with gs files inside IntelliJ by any chance? Would be really nice to have a plugin to provide support. I found references to an older plugin that has been removed ( https://github.com/MichaelSnowden/intellij-gas-plugin ) with a clone here: ( https://github.com/kehh/intellij-gas-plugin ), but haven't tried it out yet to see if it works with clasp.
The text was updated successfully, but these errors were encountered: