I am creating an extension for Visual Studio Code. When editing TypeScript and JavaScript files, I augment specific parts of the source code depending on the type of the related AST node.
To gain access to the type information required, I use createProgram
of TypeScript as described here: https://learning-notes.mistermicheels.com/javascript/typescript/compiler-api/#getting-type-information
Even though I can work with this up to some extent, this solution is far from optimal: TypeScript code gets compiled at least twice:
I would like to circumvent this additional effort since, especially for larger projects, it means a lot of extra stress on the CPU.
Is there a way how 3rd party vscode extensions can access the AST and type information generated by vscode's own, built-in TypeScript language server?
This is officially supported now: https://github.com/microsoft/TypeScript/issues/43893
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.