Repository navigation
Language Service Plugins with Proxies #11976
Description
Activity
- addedDiscussionIssues which may not have code impactIssues which may not have code impact
on Nov 1, 2016 If I'm not mistaken, the wrapped/decorated language service model was already how Chuck Jazdzewski (@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.
Ryan Cavanaugh (@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.
RyanCavanaugh commented
on Nov 1, 2016 MemberAuthorMore actionsWesley Wigham (@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.
RyanCavanaugh commented
on Aug 12, 2017 MemberAuthorMore actionsClosing for housekeeping purposes
- locked and limited conversation to collaborators
on Jun 19, 2018
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
{ "compilerOptions": { "strictNullChecks": false, "plugins": [ { "name": "myPlugin" } ] }, "files": ["sample.ts"] }This configures the
my-pluginpluginLoading
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
createmethod:The implementation of
myPluginmight look like this/cc Chuck Jazdzewski (@chuckjaz)