-
Notifications
You must be signed in to change notification settings - Fork 12.3k
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
Feature Request: LanguageServiceHost plugin #29706
Comments
I second this proposal.
I'm also not even really sure if this would work anyways, but I figured it might be a solution until official support comes. Edit: also support for async |
Hello, is this still under discussion? Its almost year old. This feature will be handy as described above and as monkey patching does not work anymore it is not possible to do a custom module resolution. |
Hey there. |
Sure I do. It is because they enclosed important parts of the compiler to “private” closures so it is not accessible anymore thus it can’t be monkey patched once the compiler is loaded.
|
A note for those who come after, I learned one workable workaround here: https://github.com/mrmckeb/typescript-plugin-css-modules/blob/main/src/index.ts. In short, you can create a completely new language service instance with a customized host then return it. |
Search Terms
language service host compiler plugin
Refs #16607
Suggestion
Currently, TypeScript only supports proxying the language service. It would be good to have an officially supported way of being able to proxy the
LanguageServiceHost
as well.Use Cases
Being able to provide a plugin that changes how the language service host behaves is often a requirement for use cases where the default behaviour of TypeScript in Visual Studio Code does not mirror the compile time behaviour when using tools that implement a language service host with TypeScript.
For example in Deno, we utilise full path names for modules, including TypeScript ones. The standard language service host disallows this (because it assumes that the module name won't end in
.ts
at runtime).There are likely to be other use cases where the behaviour of the language service host differs when using other forms of TypeScript other than
tsc
and Visual Studio Code, where it would be useful to allow plugins to mimic that behaviour, in particular in Visual Studio Code, so that the editing experience can be more rich.Examples
I currently have a plugin which just monkey patches the LanguageServiceHost to inject similar logic for module resolution to what is done in Deno. This is because I cannot return a proxy, like I could with the
LanaguageService
.Checklist
My suggestion meets these guidelines:
The text was updated successfully, but these errors were encountered: