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

vsx: update compatibility check for builtins #9486

Merged
merged 1 commit into from
May 25, 2021

Conversation

vince-fugnitto
Copy link
Member

@vince-fugnitto vince-fugnitto commented May 14, 2021

Problem

The framework requires special logic when handling builtin extensions which are maintained by the project:

  • vscode-builtin-extension: builtin extensions which are bundled with vscode
  • vscode-builtin-extension-packs: builtin extension pack containing bundled vscode extensions referenced by id.

The issue is that these such extensions do not necessarily maintain their engines.vscode field so instead we should be smarter and fetch compatible versions of these extensions by their actual version (which corresponds to the actual vscode version). This way, we are more likely to fetch a valid version of an extension which satisfies our API level.

What it does

The changes include updating the logic to determine compatible versions of extensions:

  • project maintained builtins (vscode): we check compatibility based on version.
  • builtin (non-vscode bundled extensions): we check compatibility based on engines.vscode version.
  • other extensions: we check compatibility based on engines.vscode version.

The changes determine builtin compatibility by using semver.lte (less than or equal) in order to get a version which matches the API version, or a previous version to ensure that extensions are compatible.

The changes also include the VSXBuiltinNamespaces namespace which contains information on reserved builtin namespaces:

  • vscode: reserved for individual vscode builtin extensions.
  • eclipse-theia: reserved for builtin extension-packs of individual vscode builtin extensions.

How to test

  1. remove the plugins folder and temp files (ex: rm -rf plugins/, rm -rf /tmp/vscode-unpacked, rm -rf ~/theia/extensions).
  2. start the application.
  3. search for vscode builtin extensions (ex: json-language-features - the extension should be at 1.50.0 (current API level).
  4. searching other extensions should behave like today.
  5. installing extensions should work correctly.
  6. repeat step 1 - ensure that no builtins are present.
  7. add the following extension-pack.
  8. ensure that extensions in the pack are resolved to version 1.50.0 if it exists, else a previous version if it exists.

Review checklist

Reminder for reviewers

Signed-off-by: vince-fugnitto [email protected]

@vince-fugnitto vince-fugnitto added builtins Issues related to VS Code builtin extensions vsx-registry Issues related to Open VSX Registry Integration labels May 14, 2021
The changeset updates the logic when getting the latest compatible
version of a builtin extension (individual or pack) by fetching the
version which is defined by api version supported by the framework.

Since the `engines.vscode` property is generally not maintained by
vscode builtin extensions (since they are bundled with vscode at a
specific version) we cannot rely on the `engines.vscode` version to
fetch a compatible extension. Instead, we now fetch a version which
corresponds to the api level the framework defines.

Signed-off-by: vince-fugnitto <[email protected]>
Copy link
Contributor

@alvsan09 alvsan09 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have tested the behavior is as expected,
In addition to the suggested test, I did:

  • bring the VSCODE_DEFAULT_API_VERSION down to as early as 1.44.2 works to select the proper versions from UI.
  • Installing a builtin-extension-pack from the registry at runtime works

Just a minor optimization as inline comment is pending.

@marcdumais-work
Copy link
Contributor

You may want to clean this folder as well, specially if you tested installing the pack with the example app:
~/.theia/extensions

Copy link
Contributor

@marcdumais-work marcdumais-work left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested locally: we pull appropriate versions of built-ins, individually at runtime and when installing the pack too. Thanks @vince-fugnitto !

@vince-fugnitto
Copy link
Member Author

I'll merge early next week if there are no objections, thank you for the reviews!

@vince-fugnitto vince-fugnitto merged commit dab288c into master May 25, 2021
@vince-fugnitto vince-fugnitto deleted the vf/builtin-compatibility branch May 25, 2021 12:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
builtins Issues related to VS Code builtin extensions vsx-registry Issues related to Open VSX Registry Integration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants