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

Where is vscode.proposed.d.ts? #136964

Closed
jrieken opened this issue Nov 11, 2021 · 12 comments
Closed

Where is vscode.proposed.d.ts? #136964

jrieken opened this issue Nov 11, 2021 · 12 comments
Assignees
Labels
api under-discussion Issue is under discussion for relevance, priority, approach

Comments

@jrieken
Copy link
Member

jrieken commented Nov 11, 2021

The vscode.proposed.d.ts-file has been split up into separate files, each representing one proposal. This enables scoped access to proposals (see #131165 for details and discussion)

Extensions need to opt into specific proposals via the new package.json#enabledApiProposals-property. The enableProposedApi-property will stop working soon.

Migration Guide

  1. First, validate that you still need proposed API access. Often proposals have been finalized and using proposed API isn't needed anymore. Try this:

    1. get latest vscode.d.ts via @types/vscode or >npx vscode-dts main
    2. delete the vscode.proposed.d.ts-file
    3. compile your project
    4. iff there are no errors, you are done. You can also delete the package.json#enableProposedApi-property.
    5. go to step 3 ❗
  2. You have validated that your extension still depends on proposed API. Do the following:

    1. Spell out each proposal you want at package.json#enabledApiProposals. It's this property that enables proposals!
    2. delete the vscode.proposed.d.ts-file
    3. get latest vscode-dts and run npx vscode-dts dev to fetch the proposal-definitions you need.
    4. go to step 3 ❗
  3. More tricky is proposed API usage that isn't TypeScript, namely proposed contribution points or properties of package.json. This is fortunately rare and but some manual labor and diligence is needed. Check the vscode.proposed.contribXYZ.d.ts files for package.json-properties you are using and add the proposal names to the package.json#enabledApiProposals-property

FAQ

Sample

This is a sample commit microsoft/vscode-anycode@cf73d4d that migrates anycode onto a specific API proposal.

Is this a breaking change?

Not yet. For now we are breaking up vscode.proposed.d.ts but we still honor the enableProposedApi-property for a bit. So, you likely see TypeScript compile errors but the runtime behavior isn't changed yet.

Are changes to package.json and to vscode.proposed.XYZ.d.ts needed?

The changes to package.json#enabledApiProposals are absolutely needed, they are the truth while dts files are "only" needed for the TypeScript compiler.

What about package.json#enableProposedApi

When your extension is enabled via our product.json-file you can safely remove the property. VS Code will enable your extension, also older version which don't support enabledApiProposals yet.

@daimor

This comment has been minimized.

@jrieken

This comment has been minimized.

@daimor

This comment has been minimized.

@daimor

This comment has been minimized.

@jrieken

This comment has been minimized.

@joyceerhl
Copy link
Collaborator

@jrieken will it still be possible for extensions to pass --enable-proposed-api at the CLI? It seems to not work in VS Code Stable at the moment.

@jrieken
Copy link
Member Author

jrieken commented Dec 6, 2021

Yes, it will still be possible to use the --enable-proposed-api option but that isn't backwards compatible, e.g it will require to keep the old and new properties in package.json

@Krzysztof-Cieslak
Copy link
Contributor

Yes, it will still be possible to use the --enable-proposed-api option but that isn't backwards compatible, e.g it will require to keep the old and new properties in package.json

@jrieken, is there any CLI option for the new enabledApiProposals syntax? Or do we need to keep the old syntax too in our package.json if we want to give users the option to use proposed APIs?

@jrieken
Copy link
Member Author

jrieken commented Jan 24, 2022

@jrieken, is there any CLI option for the new enabledApiProposals syntax?

The "old", existing CLI option works for the new property. When passed it enables all proposals for an extension. However, it isn't backwards compatible, e.g when users have an old version of VS Code with a new version of your extension than it won't enable the "old world". Tho, I would argue that's a corner-case as the CLI option is intended for special cases.

@Krzysztof-Cieslak
Copy link
Contributor

Thanks for the details @jrieken, that makes sense 👍
Just to confirm - have those changes been released in the current stable version of VSCode (1.63.2)?

We do have user reporting that Code OSS 1.63.2 have problems with the latest Copilot (using enabledApiProposals) despite using enable-proposed-api CLI arg (in argv.json).

community/community#6629 (reply in thread)

@jrieken
Copy link
Member Author

jrieken commented Jan 24, 2022

Yes, this should work with 1.63.2

@mjbvz
Copy link
Collaborator

mjbvz commented May 5, 2022

Closing as we have shipped with the split up vscode.proposed.d.ts for a few iterations now

@mjbvz mjbvz closed this as completed May 5, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Jun 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api under-discussion Issue is under discussion for relevance, priority, approach
Projects
None yet
Development

No branches or pull requests

5 participants