-
Notifications
You must be signed in to change notification settings - Fork 28.9k
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
Add command to manage proposed api enablement #110617
Conversation
@JacksonKearl I do not understand what's being solved here. If you are actively developing an extension than you are free to use proposed API anyways. It seems that you want to enable seamless selfhosting/consumption of extensions that use proposed API by anyone and that's something we should never support |
I agree that I would also like to understand what is the usecase and why do we think this is a good idea. |
My take on the situation:
We're having to send our end users down the |
Should have never been like and I don't know of any doc/resource that states the opposite.
There are very easy ways around this.
That shows a fundamental misunderstanding of what proposed API is for. This is a feature for extension authors, not extension consumers. Sorry, this will now go in a direction which you won't like: I will refresh my memory for why we added support to enable proposed API via command line flags and I will work towards removing that. We do support proposed API via |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My proposed follow up item: #110729
In my opinion, the reason we get so little feedback from extension authors regarding Proposed API is that it's too hard to selfhost extensions using Proposed API, so they end up not being created in the first place, or even if they are created they don't get enough hours of use for issues to really present themselves.
If you ask me we can only blame ourselves -- extension authors aren't going to dedicate lots of their time to learning a new API and helping us out by providing feedback if we don't even let them selfhost the extension they're creating without jumping through hoops every time they launch the app. Take for instance Notebooks, we only have a handful of Notebook extensions allowed in If I understand correctly, the concern with opening up too many extensions to use Proposed API is:
I agree that fragmentation is to be avoided, but I believe we mitigate this by only opening up to Insiders users (who have self-selected to update daily) and showing the flashing warning dialog explaining that this isn't to be used outside of testing purposes.
Probably better to use the insiders right before the new Stable, as that's the same as Stable. The one right after a new Stable comes is the least hardened of any in the cycle (1+ week of dev work with 0 user testing 🙂) |
Only register action in non-Stable Update wording
After discussing with @kieferrm we agree the value added by getting more use of proposed api is substantial, accordingly I've removed the hidden setting feature flag and slightly modified the wording: Also @sbatten had an interesting idea to disable all escape hatches in Stable (such as |
I have had success with asking individuals who want specific API to try out a proposal and confirm that it works well for them. I have seen no need to enable selfhosting of proposed API. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 LGTM.
It would be nice, as the complexity of ProposedApiController
grows, that we extract the code to a separate file or even go so far and create a new service, IProposedApiService
, which encapsulates all this logic.
I suggest that @JacksonKearl and @jrieken you get together and decide what you do. The proposed API feature was initially implemented by @jrieken and I think his review is more important than mine. I own the file, but not the proposed API mechanisms, that's why I suggest to extract the code somewhere else, since my review is not really needed.
Still 👎 With this approach any user will be able use extensions consuming proposed API without our consent nor knowledge. That will play against our reputation of being a stable host for extensions. We will break proposed APIs and extensions will fail and what happens is that bugs are filed against us. You will see the dialog today and in a couple of month when your favourite extension stops working you will not remember that you have clicked a button. Take this issue as a sample: #110569. To blame is LiveShare which hasn't adopted a change in Apart from the massive headaches this will be causing I am actually not convinced that "more users of feature using proposed API Y leads in good or more feedback on the proposed API Y". I cannot follow that logic and I actually don't recall issues where such feedback has been provided. Also not for the search api proposal which apparently gets used via command-line tricks. |
Since apparently nobody read #110729 (comment). It says
What that means, and what the LiveShare case (#110569) shows, is that listing extension identifiers in What I mean: We have no idea what proposed API an extension is using (and shipping with). We have no idea when those extensions are broken because of our changes. Also, extension authors apparently have no idea when they are broken because their CI isn't proper and because they aren't on top of things. The result is a broken experience in VSCode and issues filed against us (again see #110569). What I propose: We want to know when an extension (that uses proposed API) doesn't work any more. With that we would simply disable it and tell the user something like "extension foo is disabled because it didn't adopt changes of preview features it uses". I believe the granularity should be a proposal (which in vscode.proposed.d.ts is represented as regions, sample). The version can be implicit, like a content hash of the proposal, or explicit, like a version number in the region-comment. An extensions |
Yeah. At least that's how it is today with extensions listed in |
Wait... What we didn't consider is that such a function means that we cannot disable an extension when its declared api usage isn't matching the actual proposed API shape. We would need to rely on extensions using this check and otherwise obscure failures happen. I don't think we want that and that we should start with "little power" |
Spitballing some way we could make the dynamic proposal availability checking well-typed and enforceable... vscode.proposed.d.ts //#region https://github.com/microsoft/vscode/pull/110617
//#id ExampleProposal
export function myProposedAPI(): void;
//#endregion vscode.proposalHashes.ts (generated at buildtime) export const ProposalHashes = {
ExampleProposal: 'S0M3HA5H',
....
} vscode.proposalGates.d.ts (generated at buildtime) declare module 'vscode' {
export namespace env {
export function acquireProposedApi(
id: 'ExampleProposal',
version: ProposalHashes['ExampleProposal']
): undefined | vscode & { /* type of the proposal */ }
... etc for all proposed ...
}
} extHostImpl.ts function myProposedAPI() {
if (!extensionProposalService.hasProposalGrant(ext, ExampleProposal)
throw "Extension needs updating blah blah blah")
doMyProposedAPI()
}
function acquireProposedApi(id: string, version: string) {
if (version === ProposalHashes[id]) {
extensionProposalService.grantProposedAPI(ext)
return vscodeAPIImpl
}
console.warn(ext, 'wants proposed api but blah blah blah')
return undefined
} extension.ts import * as vscode from 'vscode' // Only including vscode.d.ts and vscode.proposalGates.d.ts
activate() {
const vscodeWithProposal = acquireProposedApi('ExampleProposal', 'S0M3HA5H');
if (vscodeWithProposal) {
vscodeWithProposal.myProposedAPI();
}
} Some open questions remain, including how extensions migrate from proposed to stable when proposals become solidified, and how we could handle making backwards compatible changes to the API's without breaking everything when the hash changes. |
This is an interesting proposal but things are more complex (as always). Not all proposed APIs are symbols that you can probe for, some are just "receivers". Take this for instance: vscode/src/vs/vscode.proposed.d.ts Lines 1016 to 1022 in 12b808c
Newly proposed is the Also, in the approach this is assumed: import * as vscode from 'vscode' // Only including vscode.d.ts and vscode.proposalGates.d.ts Assuming that proposals aren't defined in the In short, I stand by my original strictness of being able to tell that a proposal isn't available statically and then disabling extensions. I agree that feature probing is somewhat cool tech but it is a non-goal of the API proposal process. For now, I would propose that we focus on the very first step which is to define a declaration for identifying and versioning proposal. Some format that can be authored in
Given those considerations (which are likely incomplete) I would propose something like this:
Sample: //#region https://github.com/microsoft/vscode/issues/998877 cfe87ae
/**
* Bla, api is cool
*/
export const foo: number;
//#end region The following is true
With that information extension authors can quickly look-up what proposal and version they are toying and we have little hassle with maintaining that information |
Might be a good idea if Issue Reporter's list of extensions indicated which ones have proposed API enabled. Then we just need to get people to use Issue Reporter... |
This will not happen |
This PR fixes #106427. Well not really because we disallow it in stable, but it fixes the part where it broke in Insiders too.
New model:
"extensions.enableProposedAPIOverride": true
product.json
)The list of overrides is stored in local storage, so we can't access it from the
EnvironmentService
(sad @jrieken), but also it doesn't require a file read (happy @alexdima). Also I got rid of all of the modifications toargv.json
(happy @bpasero)