-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
TypeScript code generation from the Language Service #3241
Comments
@ctaggart can you provide more details? you want some AST factory functions to allow you to generate AST on the fly?
It is not missing, it is just hidden :) see this example for how it can be done. We would be open to accept a PR to add a new |
Also helpful here is @basarat 's Compiler Overview: http://basarat.gitbooks.io/typescript/content/docs/compiler/overview.html @mhegazy Yes, I want to generate AST on the fly and then be able to print/emit the generated TypeScript. I could use some help getting started. Any idea what the tests might look like for this. |
I attempted this again given some hints from @CyrusNajmabadi at the MVP Summit, but no luck. You can clone https://github.com/ctaggart/TsAst to see what I tried or just view the commit linked above. I would love a review and some help. |
I would not use the formatter. I would call Hope that helps! |
@CyrusNajmabadi, I'm taking another look at this today. It looks like Any idea what the right function might be for emitting TypesScript source files? I'm going to take a look at |
The |
As a heads up @ctaggart, @rbuckton is working on tree transformation infrastructure and a pretty printer. It's to help us with general codegen between emit targets, but we're hoping that down the line it can be used in the language service as well. That might be useful for your purposes, so we'll try to keep you posted. 😃 |
Thanks @DanielRosenwasser, really looking forward to what @rbuckton puts together! Meanwhile, I'm still hacking my way though. My current thought is that if I can build up the AST from scratch and get it to output
I'll see if I can make use of |
I'm giving up for now. @rbuckton, I'm interested in whatever you come up with. |
this should be part of the work in #5595 |
closing in favor of #5595 |
It would be great if we could generate TypeScript code using the Language Service. This is a feature request continuing on #1651. A pretty printer is missing that consumes only the AST. Like #3136, a use case would be generating TypeScript code from a Swagger/RAML/REST api that is well defined.
The text was updated successfully, but these errors were encountered: