Skip to content
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

Add version check when loading tsserver plugins #19224

Closed
mjbvz opened this issue Oct 16, 2017 · 4 comments
Closed

Add version check when loading tsserver plugins #19224

mjbvz opened this issue Oct 16, 2017 · 4 comments
Labels
Docs The issue relates to how you learn TypeScript
Milestone

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Oct 16, 2017

Problem
A TS Server plugin may depend on a TypeScript API that is only available in specific versions of typescript, such as TS 2.6+ for example. Currently the TypeScript server will always attempt to load this plugin, even if it does not meet those requirements.

Proposal
In the plugin's package.json, add a engines: typescriptserver section:

{
     "engines": {
        "typescriptserver": "^2.6.0"
    }
}

this entry would specify a semver that the typescript server would check against its own version to determine if a plugin can be loaded or not. If a plugin is not compatible, we should generate an error event (see #18849)

@RyanCavanaugh
Copy link
Member

Plugins can already do whatever they want by checking ts.version at runtime.

@mhegazy
Copy link
Contributor

mhegazy commented Oct 31, 2017

ts.version is not the right check here. it assumes that any change to the language version means a breaking change to the API, which is not true.

The correct version to use is ts.servicesVersion is the right one to check. we only change this version when we update the API in a breaking fashion. see #19455 (comment) and #19507 for an example.

@RyanCavanaugh can we update the docs with these recommendations?

@mhegazy mhegazy added the Docs The issue relates to how you learn TypeScript label Oct 31, 2017
@mjbvz
Copy link
Contributor Author

mjbvz commented Nov 15, 2018

@DanielRosenwasser @minestarks This is another one we should make sure we handle for IntelliCode. Looks like no action is required here besides documentation and a runtime check in the plugin itself.

@mjbvz
Copy link
Contributor Author

mjbvz commented Jan 29, 2020

Closing since I we decided to leave this up to each plugin

@mjbvz mjbvz closed this as completed Jan 29, 2020
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs The issue relates to how you learn TypeScript
Projects
None yet
Development

No branches or pull requests

3 participants