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

Extension development shouldn't check for engines.vscode being * #31574

Closed
joaomoreno opened this issue Jul 27, 2017 · 16 comments
Closed

Extension development shouldn't check for engines.vscode being * #31574

joaomoreno opened this issue Jul 27, 2017 · 16 comments
Assignees
Labels
extension-host Extension host issues verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@joaomoreno
Copy link
Member

Testing #31448

We often have to change engines.vscode to * in order to get the latest vscode.d.ts while developing an extension. If you F5 that extension you'll get an error that the vscode version isn't valid. This is always such a pain to go through every time one needs to test an extension using a new API.

IMO in extension development mode, the extension should still be loaded. This error shouldn't be there.

@bpasero
Copy link
Member

bpasero commented Aug 11, 2017

Yeah agree.

@sandy081 moving to you since it seems the API check is done in extensionValidator.

I wonder if we should just always allow a version to be "*" given that we allow this when you run npm install in the extension?

Otherwise, the simplest way of knowing that you are running inside the extension development host is via IEnvironmentService.isExtensionDevelopment

@bpasero bpasero assigned sandy081 and unassigned bpasero Aug 11, 2017
@sandy081
Copy link
Member

What does it mean if an extension has engines.vscode value * in a production version? This extension is compatible with any vscode? Not sure about complete impact.

Better improvement would be to allow it only during extension development.

@sandy081 sandy081 added this to the August 2017 milestone Aug 21, 2017
@sandy081 sandy081 added the extension-host Extension host issues label Aug 21, 2017
@sandy081 sandy081 modified the milestones: September 2017, August 2017 Aug 23, 2017
@sandy081 sandy081 added the feature-request Request for new features or functionality label Aug 25, 2017
@sandy081 sandy081 modified the milestones: September 2017, October 2017 Sep 25, 2017
@sandy081 sandy081 modified the milestones: October 2017, Backlog Oct 27, 2017
@moshfeu
Copy link
Contributor

moshfeu commented Sep 25, 2018

I faced this pain when I tried to understand which engine I should specify to get the typings for createTerminal.
The solution can be either specify in the docs, from which version it can be used (just like jQuery). Or specify the version in the vscode.d.ts.

@sandy081
Copy link
Member

Ignoring * while development might confuses the author that why it works while development and not in production (after published).

@joaomoreno What is the validation in vsce? Does it allow * ?

@alexandrudima FYI

@joaomoreno
Copy link
Member Author

joaomoreno commented Mar 26, 2019

Though I think it does not apply since one uses VSCE when ready to publish, at which point the engine should not be *, VSCE does accept *: https://github.com/Microsoft/vscode-vsce/blob/master/src/validation.ts#L40

@sandy081
Copy link
Member

Since we do not support * in production, we can have a guard in VSCE to prevent this?

Given that VSCE will guard it, I think it is ok to allow * while testing an extension in development

@alexdima
Copy link
Member

I disagree with changing the engine check logic.

@sandy081 sandy081 added under-discussion Issue is under discussion for relevance, priority, approach and removed feature-request Request for new features or functionality labels Mar 27, 2019
@sandy081 sandy081 removed this from the April 2019 milestone Mar 27, 2019
@sandy081
Copy link
Member

@alexandrudima Can you please state your reasons.

@alexdima
Copy link
Member

The engine check logic should be 100% the same when a developer tries out their extension and when the extension is installed on a user machine. In other words, it is very important to have reproducibility, especially around something that can brick your extension.

And what is the use-case? What percentage of extension authors need to use * to use the vscode.d.ts on master? Moreover, is this even the case anymore with @octref 's work? I think the vscode.d.ts is now coming in from @types, and no longer downloaded based on the engines version, so the whole issue is IMHO artificial and outdated and dangerous as it would lead to a bad change.

@octref octref self-assigned this Mar 27, 2019
@octref
Copy link
Contributor

octref commented Mar 27, 2019

I have this item in #71048 (will do it in May):

Provide a module vscode-dts, so we can run npx vscode-dts dev or npx vscode-dts 1.30 etc for testing.

The logic for npx vscode-dts dev would be:

  • Download latest vscode.d.ts from master branch
  • Replace the vscode.d.ts in either vscode or @types/vscode
  • npx vscode-dts restore would restore correct version of vscode.d.ts
    • For vscode, restore according to engines.vscode
    • For @types/vscode, restore according to node_modules/@types/vscode/package.json

Also plan to have a hidden command npx vscode-dts proposed which does all above + downloading a copy of vscode.proposed.d.ts + enableProposedAPI: true. Hidden because we don't want too much attention on using proposed APIs.

@sandy081
Copy link
Member

If we are going away from using vscode.engine to download vscode.d.ts, then we should make * as invalidate everywhere.

@alexdima alexdima reopened this Mar 28, 2019
@alexdima
Copy link
Member

alexdima commented Mar 28, 2019

If we are going away from using vscode.engine to download vscode.d.ts, then we should make * as invalidate everywhere.

It is already invalid everywhere in the runtime checks, that's why I kindly ask to not touch the logic.

@sandy081
Copy link
Member

I mean also while installing extensions, where we check this to get the compatible extension to install.

@alexdima
Copy link
Member

@sandy081 Do you mean there are today extensions published in the marketplace with the engine *? How is that possible? They would never load in VS Code. We only allow built-in extensions to use *.

@sandy081
Copy link
Member

sandy081 commented Apr 1, 2019

@alexandrudima Yes, there can be extensions published with * as VSCE does not restrict it, see comment. Also while looking for a compatible extension to install, we take * as valid value. There is some gap and inconsistency here.

I am sure there are no such extensions because as you said we do not load them in ext host.

@octref
Copy link
Contributor

octref commented Jun 28, 2019

We often have to change engines.vscode to * in order to get the latest vscode.d.ts while developing an extension.

That is no longer the case. vscode-dts will download and remove the duplicate vscode.d.ts from either node_modules/vscode or node_modules/@types/vscode upon your confirmation.

dev

Can we close this issue then? I also agree we should keep the engines.vscode working as it is now.

@octref octref added this to the July 2019 milestone Jun 28, 2019
@sandy081 sandy081 removed the under-discussion Issue is under discussion for relevance, priority, approach label Jun 30, 2019
@sandy081 sandy081 removed their assignment Jun 30, 2019
@sandy081 sandy081 added the verification-needed Verification of issue is requested label Jun 30, 2019
@lramos15 lramos15 added the verified Verification succeeded label Jul 30, 2019
@vscodebot vscodebot bot locked and limited conversation to collaborators Aug 14, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
extension-host Extension host issues verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

7 participants