How can you identify what versions of VS Code an extensions will work with?

Viewed 749

I'm trying to install the MS Python extension (ms-python.python-2020.7.96456.vsix) on a VS Code (1.40.2) install and I'm receiving the following error. "Unable to install extension 'ms-python-python' as it is not compatible with VS Code '1.40.2'". How do I go about finding out what version would be compatible? I'm in an environment where I can't connect to the internet, so the vsix must be used in an offline mode.

1 Answers

Thanks rioV8! After looking into the package.json I've found that the "engines" field is what details the minimum version of VS Code required.

Per code.visualstudio.com (https://code.visualstudio.com/api/working-with-extensions/publishing-extension)

Visual Studio Code compatibility

When authoring an extension, you will need to describe what is the extension's compatibility to Visual Studio Code itself. This can be done via the engines.vscode field inside package.json:

{ "engines": { "vscode": "^1.8.0" } }

A value of 1.8.0 means that your extension is compatible only with VS Code 1.8.0. A value of ^1.8.0 means that your extension is compatible with VS Code 1.8.0 and onwards, including 1.8.1, 1.9.0, etc.

You can use the engines.vscode field to make sure the extension only gets installed for clients that contain the API you depend on. This mechanism plays well with the Stable release as well as the Insiders one.

For example, imagine that the latest Stable version of VS Code is 1.8.0 and that during 1.9.0's development a new API is introduced and thus made available in the Insider release through version 1.9.0-insider. If you want to publish an extension version that benefits from this API, you should indicate a version dependency of ^1.9.0. Your new extension version will be installed only on VS Code greater than or equal to 1.9.0, which means all current Insider customers will get it, while the Stable ones will only get the update when Stable reaches 1.9.0.

Related