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

[Fix] Implement platform specific URL format #238890

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

rrmistry
Copy link

Fixes #238886

TLDR: Test with below steps

  1. Add a built-in extension in product.json for multi-platform extensions (e.g. ms-python.debugpy)
  2. Build the extensions list using npm run gulp compile-extensions-build

Please see the description in the related issue for how to test this in the linked issue.

The issue was that marketplace links required a URL query parameter for multi-platform extensions or it fails with HTTP 404 status (e.g. ?targetPlatform=linux-x64).

This was missing in the current implementation for the build/lib/extensions.ts::fromMarketplace function.

Fixed this by checking the platforms list from the IExtensionDefinition interface (as used in product.json). If this platforms key is specified and current platform is in the provided list then add the necessary URL query parameter for the marketplace service.

This was tested by adding the below platforms in the product.json file:

{
    // ...
    "extensionsGallery": {
        "serviceUrl": "https://open-vsx.org/vscode/gallery",
        "itemUrl": "https://open-vsx.org/vscode/item",
        "resourceUrlTemplate": "https://open-vsx.org/api/{publisher}/{name}/{targetPlatform}/{version}/file/{path}"
    },
    "linkProtectionTrustedDomains": [
        "https://open-vsx.org"
    ],
    "builtInExtensions": [
        // ...
        {
            "name": "ms-python.debugpy",
            "version": "latest",
            "platforms": [      // <<<<<<
                "linux-x64",    // <<<<<<
                "linux-arm64"   // <<<<<<
            ],                  // <<<<<<
            "repo": "https://github.com/microsoft/vscode-python-debugger",
            "metadata": {
                "publisherId": {
                    "publisherName": "ms-vscode",
                    "displayName": "Microsoft",
                    "flags": "verified"
                },
                "publisherDisplayName": "Microsoft"
            }
        }
    ]
}

Related: #180525 / PR: #182072

@rrmistry
Copy link
Author

Converting to draft as I see that now I need to also update build/lib/extensions.js from the TypeScript file.

Will need to find out how to do that first so I can make the necessary edits and update the PR again.

@dbaeumer dbaeumer assigned joaomoreno and unassigned dbaeumer Jan 28, 2025
@isidorn isidorn assigned isidorn and unassigned joaomoreno Jan 29, 2025
@rrmistry rrmistry marked this pull request as ready for review January 31, 2025 02:17
@rrmistry rrmistry marked this pull request as draft January 31, 2025 02:17
@rrmistry
Copy link
Author

rrmistry commented Feb 3, 2025

@microsoft-github-policy-service agree

@rrmistry rrmistry marked this pull request as ready for review February 3, 2025 20:58
@rrmistry
Copy link
Author

rrmistry commented Feb 3, 2025

Apologies @818Nawaf for delays but I had to see what is the best native way to update the javascript files under build/lib/ folder from my changes.

Eventually found the command:

npm run update-build-ts-version

This updated build/lib/extensions.js from build/lib/extensions.ts

Could you please re-approve the PR?

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Adopt using platform specifier for built-in extensions
5 participants