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

Manually installing pre-release VSIX does not register it as prerelease #140949

Closed
Colengms opened this issue Jan 19, 2022 · 15 comments
Closed

Manually installing pre-release VSIX does not register it as prerelease #140949

Colengms opened this issue Jan 19, 2022 · 15 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug extensions Issues concerning extensions insiders-released Patch has been released in VS Code Insiders verified Verification succeeded
Milestone

Comments

@Colengms
Copy link
Contributor

With VS Code Insiders, when I install a prerelease of our new platform-specific VSIX, it does not register as prerelease:

image

This issue only occurs with VS Code Insiders:

Version: 1.64.0-insider (user setup)
Commit: 23aa7ad
Date: 2022-01-18T09:44:38.476Z
Electron: 13.5.2
Chromium: 91.0.4472.164
Node.js: 14.16.0
V8: 9.1.269.39-electron.0
OS: Windows_NT x64 10.0.22000

This does not repro with VS Code (non-Insiders, 1.63.2). That displays the prerelease indication correctly, when installing the very same VSIX:

image

@sandy081
Copy link
Member

Can you please share the VSIX to try out and reproduce?

@sandy081 sandy081 added the info-needed Issue requires more information from poster label Jan 20, 2022
@gjsjohnmurray
Copy link
Contributor

I think I am seeing this too, with an extension for which regular and pre-release versions have been published on Marketplace

  1. Package a pre-release VSIX: vsce package --pre-release
  2. Install the VSIX by dropping it into the Extensions view.
  3. Reload if prompted.
  4. 🐛 The entry in Extensions view doesn't display as a pre-release.

I am 100% sure the VSIX got built with the --pre-release switch. Indeed, when I subsequently upload it manually onto Marketplace it correctly lists as a pre-release, and installs as a pre-release.

@Colengms
Copy link
Contributor Author

Colengms commented Jan 20, 2022

Hi @sandy081 . The issue repro's with v1.8.0 (prerelease) of the C/C++ extension in the marketplace. (The same as pictured). You can download it directly from the marketplace web site here: https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools When installed from within VS Code Insiders marketplace UI, the same VSIX shows as Prerelease.

@sandy081 sandy081 added bug Issue identified by VS Code Team member as probable bug extensions Issues concerning extensions and removed info-needed Issue requires more information from poster labels Jan 22, 2022
@sandy081 sandy081 added this to the January 2022 milestone Jan 22, 2022
@sandy081
Copy link
Member

@Colengms Thanks for filing the issue. I can repro it and fixed it.

@gjsjohnmurray VS Code can detect if the installed VSIX is a pre-release or not only if the VSIX is published to the Marketplace. Because VS Code gets pre-release information from Marketplace and not from the VSIX.

@gjsjohnmurray
Copy link
Contributor

VS Code can detect if the installed VSIX is a pre-release or not only if the VSIX is published to the Marketplace.

@sandy081 I think VS Code should get this information from the VSIX manifest. Here's an example of how it can be done:

https://github.com/microsoft/vscode-vsce/blob/9b2b16b9d7cab894b98d9680f9becf63910816dc/src/publish.ts#L57-L59

@sandy081
Copy link
Member

That's true - but this could cause inconsistency if the author publishes the package with same version without pre-release flag. Hence, I prefer Marketplace to be the source of truth. Anyway this will be temporary until Marketplace supports the SemVer completely and then we can get the information from the version.

@gjsjohnmurray
Copy link
Contributor

@sandy081 this isn't making sense to me.

  1. In my extension's package.json I set version to, say, "1.3.2022012301" and package it with the command vsce package --pre-release to create a VSIX file.
  2. Without uploading this to Marketplace, and with no matching version already existing on Marketplace, I install it locally (e.g. drag/drop onto the Extensions view).
  3. It gets installed but not treated as a pre-release.

Why? Are you asking Marketplace "Is 1.3.2022012301 a pre-release version?" and treating any response other than "Yes" as meaning "No"? Even an answer that means "I know nothing about version 1.3.2022012301"?

@sandy081
Copy link
Member

Yes, I ask Marketplace if a version is a pre-release or not. It works like this:

  • when you package the vsix using vsce with pre-release flag, it adds this metadata to the vsix.
  • marketplace stores this metadata when this vsix is published
  • vscode gets the metadata from the marketplace and determines if it is a pre-release or not.

This pre-release flag to the vsce is partial support until marketplace supports semver completely, going forward, the pre-release type is checked from the version. For eg., if the version is 1.2.3-insiders then the version is considered as a pre-release. Therefore if you install the extension from vsix or from marketplace, vscode detects the pre-release from the version. We knew that the current solution is not the ideal but it helps and avoid many extensions which are creating duplicates for pre-releases/insiders. Once marketplace supports semver, extensions can start adopting to the semver versioning for pre-releases.

As you said, the metadata is still part of the vsix. At present, vscode is not reading this metadata as we rely on marketplace for this metadata. I would not do this for following reasons:

  • Source of truth is Marketplace.
  • We can always override it after reading from Marketplace, but I think its not worth to read and parse an additional manifest file (xml) just for this use case. Anyway the installed vsix will be shown as pre-release as soon as you publish the vsix to marketplace.

Hence my recommendation for this feature is to wait for MP support for SemVer. Hope you agree with this.

@gjsjohnmurray
Copy link
Contributor

  • We can always override it after reading from Marketplace

I don't want the vsix's embedded manifest to override what Marketplace says about the extension being or not being a pre-release. But when Marketplace can't answer that question (because this particular version of the vsix hasn't been published) I feel strongly that VS Code should consult the embedded manifest.

A specific use-case is that we are not permitted to publish to Marketplace a vsix that we build with proposed APIs enabled. We often want to build these so our adventurous users can download and install them (e.g. as artefacts of a GH workflow).

It is confusing when a user has installed a pre-release from Marketplace, and then they manually install a pre-release vsix built with proposed APIs enabled, and suddenly their Extensions view tells them they're running a release vsix for which a pre-release is available. If they click the button to install the pre-release, they end up downgrading to one that doesn't use proposed APIs.

Do you have an estimate for when MP will support SemVer?

@sandy081
Copy link
Member

Ah I see your use case. You can do following:

  • You can tag your VSIX version with pre-release tag, for eg: 1.1.1-pre-release
  • VS Code will detect from the vsix version if it is pre-release or not (This is yet to support)

You are forced not to publish this VSIX because the Marketplace does not support this versioning yet. If you want to publish you can increase the minor version (for eg) without pre-release tag and publish it as pre-release to Marketplace. VS Code will automatically update to latest pre-release.

Since this is not yet supported, can you please create a separate issue for this use case?

Do you have an estimate for when MP will support SemVer?

Estimating by the end of this year.

@joyceerhl
Copy link
Collaborator

Verified that the pre-release badge for v1.8.0 of the C++ extension shows up when installing the VSIX by dragging it into the extensions panel
image

@Colengms
Copy link
Contributor Author

One interesting thing I noticed: If installing a prerelease VSIX that is not yet published to the marketplace (for testing, prior to publishing), the extension is not identified as prerelease. I suspect that's because the marketplace is the authority on whether that version number is a prerelease, not the field in the VSIX manifest.

@gjsjohnmurray
Copy link
Contributor

@Colengms that is what I am unhappy about. I think in this situation VS Code should extract the vsix manifest file and check for the attribute value which marks it definitively as a pre-release. It won't be hard to do, and I am even considering submitting a PR if @sandy081 is willing to consider it after the current endgame is past.

@sandy081
Copy link
Member

@gjsjohnmurray Agreed that it is not hard, but I think this will be redundant when we move to SemVer. It seems to me not a prominent use case for implementing and removing it later. This can be waited until Marketplace supports SemVer. Just to be clear, this needs parsing the XML manifest file and VSCE uses xmltojs library, which means we have to add this dependency to VS Code or parse the xml file ourselves. I do not see a reason to do this if we do not need this in future.

@sandy081
Copy link
Member

Created a separate issue - #141869 to track this. Lets continue conversation there.

Thanks.

@github-actions github-actions bot locked and limited conversation to collaborators Mar 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug extensions Issues concerning extensions insiders-released Patch has been released in VS Code Insiders verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

6 participants
@rebornix @gjsjohnmurray @sandy081 @joyceerhl @Colengms and others