Skip to content

[WIP] vscode-extensions: support multiple extension registries#121583

Draft
ShamrockLee wants to merge 6 commits intoNixOS:masterfrom
ShamrockLee:vscode-utils
Draft

[WIP] vscode-extensions: support multiple extension registries#121583
ShamrockLee wants to merge 6 commits intoNixOS:masterfrom
ShamrockLee:vscode-utils

Conversation

@ShamrockLee
Copy link
Contributor

@ShamrockLee ShamrockLee commented May 3, 2021

Motivation for this change

According to the Microsoft Visual Studio Marketplace Term of Use, VSCodium and editors other than the officially-built Visual Studio Code are prohibited from using "Marketplace Offerings" including extensions. These editors thus use the Open VSX Registry to provide extension searching/installation features instead of the Visual Studio Marketplace .

If applied, extensions will be downloaded from the Open VSX Registry by default to make them legally available to users of open-source vscode builds and other derived editors.

This PR provides a framework to supply extensions from different registries. Four registies, vscode-marketplace, openvsx, upstream and standalone, will be added.

Two nix-prefetch packages, nix-prefetch-openvsx and nix-prefetch-vscode-mktplc are included to make pre-fetching extensions. The output will be in JSON format similar to nix-prefetch-github.

Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

@ShamrockLee ShamrockLee changed the title [WIP] vscode-utils.fetchVsixFromVscodeMarketplace: Add option useOpenVSX [WIP] vscode-utils.fetchVsixFromVscodeMarketplace: Add option useOpenVSX and default to Open VSX May 3, 2021
@ofborg ofborg bot added 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels May 3, 2021
@ShamrockLee ShamrockLee changed the title [WIP] vscode-utils.fetchVsixFromVscodeMarketplace: Add option useOpenVSX and default to Open VSX [WIP] [Help wanted] vscode-utils.fetchVsixFromVscodeMarketplace: Add option useOpenVSX and default to Open VSX May 3, 2021
@ShamrockLee ShamrockLee force-pushed the vscode-utils branch 2 times, most recently from 1d54924 to 5de0e3c Compare May 3, 2021 22:57
@ofborg ofborg bot requested review from dbirks and superherointj May 3, 2021 23:06
@ofborg ofborg bot added 10.rebuild-linux: 11-100 This PR causes between 11 and 100 packages to rebuild on Linux. and removed 10.rebuild-linux: 0 This PR does not cause any packages to rebuild on Linux. labels May 3, 2021
@ShamrockLee ShamrockLee changed the title [WIP] [Help wanted] vscode-utils.fetchVsixFromVscodeMarketplace: Add option useOpenVSX and default to Open VSX vscode-extensions: Default to fetch from Open VSX Registry May 18, 2021
@ofborg ofborg bot added 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. and removed 10.rebuild-darwin: 0 This PR does not cause any packages to rebuild on Darwin. labels May 18, 2021
@ShamrockLee ShamrockLee marked this pull request as ready for review May 18, 2021 16:16
@ShamrockLee ShamrockLee requested a review from jonringer as a code owner May 18, 2021 16:16
@ShamrockLee ShamrockLee force-pushed the vscode-utils branch 5 times, most recently from adfeb18 to f92ce1c Compare May 23, 2021 20:20
@ShamrockLee
Copy link
Contributor Author

Modified nix-prefetch-openvsx and nix-prefetch-vscode-mktplc to correctly delete the temporary directory.

The original way to handle exit in the update_installed_exts.sh only handles SIGINT (Ctrl-c) and successful exit, and will also delete the temporary directory used by another instance of this program.

@ShamrockLee
Copy link
Contributor Author

ShamrockLee commented May 24, 2021

@SuperSandro2000
It would be preferable to merge #113280 first and I'll then integrate with it.

  1. update_installed_exts.sh

  2. Documentation

    • misc/vscode-extensions: improve scripts for updating VSC extensions #113280 adds the documentation about VSCode and extensions.
    • The changes in this PR needs to be documented, and the sha256 values of the examples need to be changed.
    • Extra stuff to document will include:
      • Sources of extensions (Open VSX Registry / official Marketplace)
      • Two new prefetch scripts for extensions (nix-prefetch-openvsx and nix-prefetch-vscode-mktplc)
  3. Backward compatibility

@SuperSandro2000
Copy link
Member

It would be preferable to merge #113280 first and I'll then integrate with it.

Thats probably a good idea but I don't know the vscode package system that well to review the PRs well.

@ShamrockLee
Copy link
Contributor Author

Exposed useMSMktplc for future module making, with similar functionality to meta.license.free.

@ShamrockLee
Copy link
Contributor Author

ShamrockLee commented Dec 11, 2021

Here's the code implementing the serviceUrl and itemUrl adapter in the Open VSX project:

https://github.com/eclipse/openvsx/tree/f653161c7bd9b08ae80ba24df758839d72bc0fe0/server/src/main/java/org/eclipse/openvsx/adapter

The corresponding urls are:

"extensionsGallery": { "serviceUrl": "https://open-vsx.org/vscode/gallery", "itemUrl": "https://open-vsx.org/vscode/item" }

They may help us figure out a way to query the extension list of VSCode Marketplace.

@ShamrockLee
Copy link
Contributor Author

ShamrockLee commented Feb 12, 2022

I originally plan to extract extension identifiers from the index.json fetched from the obsolete cacheUrl (https://vscode.blob.core.windows.net/gallery/index) so that we can have 2000+ new extensions from the Marketplace.
Now I think we had better drop the file (index) and prevent any of the derived work from entering the source tree considering the EULA of the VSCode Marketplace.

BTW, I'm working on some fixes related to my research work, and is running out of time recently. It would take a while before I could port the custom build process here from vscode-extension. (The extensions that only go through the standard build process should now be usable.)

@nixos-discourse
Copy link

This pull request has been mentioned on NixOS Discourse. There might be relevant details there:

https://discourse.nixos.org/t/in-tree-or-out-of-tree/18389/1

@ShamrockLee
Copy link
Contributor Author

ShamrockLee commented Apr 1, 2022

I just encountered something called extension packs, which aren't managed properly by the current vscode-extensions framework.

It's quite easy to get the information -- by fetching the attribute extensionPack from package.json when bootstrapping / updating registry-reference-list.json, but we need to find a way to inject those dependent extensions and their dependent extensions ... into the VSCode / Codium.

@superherointj superherointj added the 6.topic: vscode A free and versatile code editor that supports almost every major programming language. label Jul 20, 2022
@schuelermine
Copy link
Contributor

schuelermine commented Oct 23, 2022

hey @ShamrockLee are you still working on this? I recently thought of the same kind of thing so I opened #197293, and I’m wondering if I should close in favor of this PR.

@ShamrockLee
Copy link
Contributor Author

ShamrockLee commented Oct 23, 2022

This one is still relevant, and it should already work on extensions that doesn't require custom build process.

We could also handle the extensionPack that comes along an extension with the new framework. It's rather easy to implement.

There are some problems, through:

  • I wonder if the overlay-style build process abstraction in this PR would be over-enginneering.

  • The custom build process (for extensions which needs more than unpack-and-installing to get built) needs to be ported manually to the new framework. It could be shared between registries once the name issues mentioned below could be resolved.

  • Extensions are identified with their publisher.name, which is generally the same accross registries. The package attribute name of each extension is usually identical to its publisher.name. However, the exceptions are not neglectable. One example of the name-nad-attribute mismatch is the package identified as "bbenoist.Nix" being renamed from vscode-extensions.bbenoist.Nix to vscode-extensions.bbenoist.nix. Should we just insist that the attribute be identical to publisher.name in this new framework? The naming difference between registries should be a rather mild problem, as custom build process can be mapped to different names.

@schuelermine
Copy link
Contributor

Should we just insist that the attribute be identical to publisher.name in this new framework?

I think that sounds reasonable. Couldn’t any other things be done via the aliases in the current system anyway?

@github-actions github-actions bot removed the 6.topic: vscode A free and versatile code editor that supports almost every major programming language. label Oct 24, 2022
@ShamrockLee
Copy link
Contributor Author

ShamrockLee commented Oct 24, 2022

The attribute renaming was made in commit 9ee8bd1 . It casted the letter to lower case to "keep the naming convention uniform".

@schuelermine
Copy link
Contributor

that doesn’t sound reasonable. IMO if the source is inconsistent it’d be inconsistent to make it consistent

Drop the warnings for lib.meta.getLicenseFromSpdxId fallback
to please the CI and for better user experience.

Create lib.meta.getLicenseFromSpdxId',
for which developers can specify the default value
and possible warning/error.
*   registry-lib: init
*   mkExtensionGeneral: init
*   modifiers: init
@github-actions github-actions bot added the 6.topic: vscode A free and versatile code editor that supports almost every major programming language. label Oct 29, 2022
@ShamrockLee
Copy link
Contributor Author

@schuelermine I didn't even realize that .vsix files are now provided per-platform before your PR. Do you know how the platform-specific packages differ from the ones downloaded without specifying the platform? BTW, is there a way to download .vsix files platform-wise from VSCode Marketplace?

@schuelermine
Copy link
Contributor

schuelermine commented Oct 29, 2022

@ShamrockLee
No, I don't know anything about it. I just copied the platform distinction from the API reference for Open VSX and I reused the arch property from the marketplace code, assuming it refers to the same thing.

@ShamrockLee
Copy link
Contributor Author

ShamrockLee commented Aug 2, 2023 via email

@ShamrockLee ShamrockLee mentioned this pull request Nov 26, 2023
13 tasks
@wegank wegank added 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 2.status: merge conflict This PR has merge conflicts with the target branch labels Mar 19, 2024
@stale stale bot removed the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Mar 20, 2024
@wegank wegank added the 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md label Jul 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2.status: merge conflict This PR has merge conflicts with the target branch 2.status: stale https://github.com/NixOS/nixpkgs/blob/master/.github/STALE-BOT.md 6.topic: vscode A free and versatile code editor that supports almost every major programming language. 8.has: package (new) This PR adds a new package 10.rebuild-darwin: 1-10 This PR causes between 1 and 10 packages to rebuild on Darwin. 10.rebuild-linux: 501+ This PR causes many rebuilds on Linux and should normally target the staging branches. 10.rebuild-linux: 1001-2500 This PR causes many rebuilds on Linux and should target the staging branches. 11.by: package-maintainer This PR was created by a maintainer of all the package it changes.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants