Skip to content

API: Provide Positron version requirement field for extensions #7202

@jmcphers

Description

@jmcphers

VS Code extensions can declare a required version of VS Code they work with. This is largely done in lieu of a separate API versioning scheme; the "API version" is just the VS Code version, and extensions set their API compatibility by declaring their VS Code version support using a syntax similar to other package.json fields.

This is done in the engines field of the extension manifest:

https://code.visualstudio.com/api/references/extension-manifest

An object containing at least the vscode key matching the versions of VS Code that the extension is compatible with. Cannot be *. For example: ^0.10.5 indicates compatibility with a minimum VS Code version of 0.10.5.

For example:

{
  "engines": {
    "vscode": "^1.65.0"
  }
}

It is not currently possible to do this for Positron versions, which means that extensions will be loaded into Positron even if they are incompatible, leading to issues like #7098. To address this, we should add a positron field to engines that allows extensions to declare their supported Positron version, too.

{
  "engines": {
    "vscode": "^1.65.0",
    "positron": "^2024.05.0"
  }
}

An extension that is incompatible with Positron should not be loaded or activated. We can follow the example of how VS Code treats these, which is to log an error and move on.

  ERR [/Users/jmcphers/git/example]: Extension is not compatible with Code 1.98.0. Extension requires: ^1.99.0.
error @ workbench.desktop.main.js:20985

Metadata

Metadata

Assignees

Labels

area: apiIssues related to API category.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions