-
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
Language Service Plugins with Proxies #11976
Comments
If I'm not mistaken, the wrapped/decorated language service model was already how @chuckjaz's proposal worked (and what my prototype implemented), though the API exposed here asks for monkeypatching rather than exposing hooks, and uses the single-registration-function plugin shape rather than expected-export-shape API. |
@RyanCavanaugh How do multiple language service plugins stack up in this model? It's unclear on the order they are constructed/executed in and the precedence of their return values. |
@weswigham they'd wrap to arbitrary depth. For ordering, I guess this does have to be an array, though it makes me sad. Updating. |
It's perhaps out of scope of this issue but I tell me how to extends tsserver commands to add it with plugin. For instance I would like to have a new tsserver command to return a list of Angular2 modules that I would like to use with a Angular2 wizard to generate an angular-cli generate command which waits a module. In this wizard I would like to display a list with available modules that I could retrieve with tsserver command. See angelozerr/angular-eclipse#34 |
Just for your information, I have created https://github.com/angelozerr/tsserver-plugins to consume language service proxy (like angular2 and tslint) with any version of TypeScript tsserver. |
Closing for housekeeping purposes |
Goals / non-goals
Architecture Overview
When an editor performs a language service operation, the following steps occur:
The change here is to insert a proxy (more accurately a decorator) between the project and the language service. Projects backed by tsconfig.json files will, upon creation of their language service, wrap the LS instance by invoking a factory method on the plugins listed in the config file.
Configuration
A new "plugins" section is added to tsconfig.json
This configures the
my-plugin
pluginLoading
These plugins are loaded as node modules from the folder where the tsconfig.json file is.
Initialization
Immediately after creating its language service, a tsconfig.json-based project will wrap the language service in the plugin proxy by calling its
create
method:The implementation of
myPlugin
might look like this/cc @chuckjaz
The text was updated successfully, but these errors were encountered: