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

Web: provide a workbench.web.api.d.ts for an embedder to develop against #125643

Open
bpasero opened this issue Jun 7, 2021 · 8 comments
Open
Assignees
Labels
feature-request Request for new features or functionality web Issues related to running VSCode in the web
Milestone

Comments

@bpasero
Copy link
Member

bpasero commented Jun 7, 2021

We provide an API surface for an embedder of our web UI:

interface IWorkbenchConstructionOptions {

We also require some specific setup to load our web UI pieces as indicated by our yarn web implementation:

We should:

  • investigate to produce a workbench.web.api.d.ts (similar to monaco.d.ts) for the workbench.web.api for an embedder to develop against
  • consider to extract the loader configuration into something reusable (amdconfig.js?) that an embedder can just point to
@bpasero bpasero added feature-request Request for new features or functionality web Issues related to running VSCode in the web labels Jun 7, 2021
@bpasero bpasero added this to the Backlog milestone Jun 7, 2021
@microsoft microsoft locked and limited conversation to collaborators Jun 7, 2021
@bpasero bpasero modified the milestones: Backlog, August 2021 Aug 11, 2021
@lramos15
Copy link
Member

Loader piece is done will defer the .d.ts to a later date

@lramos15 lramos15 modified the milestones: August 2021, On Deck Aug 23, 2021
@bpasero bpasero changed the title Web: improve consumption of our web bits as an embedder Web: provide a workbench.web.api.d.ts for an embedder to develop against Jan 19, 2022
@connor4312
Copy link
Member

connor4312 commented Apr 8, 2022

Following up on discussion on other internal issues, I suggest not automatically generating the .d.ts, and instead have the web api .d.ts checked into VS Code and with manually duplicated types.

The reason is that we have dependency on code and typings for embedders, but it is very easy for team members to not realize that code they're working is exposed in this API and depended upon by the embedder. This may result in breakages, especially if it's something as easy and innocent as an automated refactor for a property rename. Causing a compilation error unless the web .d.ts is manually and explicitly updated would reduce the likelihood of accidental breakages.

@bpasero
Copy link
Member Author

bpasero commented Apr 8, 2022

I think there are 2 camps: vscode.d.ts is handcrafted but monaco.d.ts for example is not and both have API users.

@joaomoreno
Copy link
Member

My 2c. I love that monaco.d.ts is automatically created, though I don't envy @alexdima from maintaining that 700 LoC machinery. I love manually authoring vscode.d.ts because it lets us craft that file so well, including docs and make sure we are properly exposed, but the overhead of maintaining two worlds is real. Maybe @jrieken's would be the PoV I'm more interested in.

@jrieken
Copy link
Member

jrieken commented Apr 12, 2022

I suggest not automatically generating the .d.ts, and instead have the web api .d.ts checked into VS Code and with manually duplicated types.

+💯. Creating those types manually is IMO the only way to guarantee awareness of changes in API and to "design" the API explicitly. That's also the different between vscode.d.ts and monaco.d.ts - the latter is a slightly cherry-picked but mostly AS-IS representation of the "internal" API.

@bpasero
Copy link
Member Author

bpasero commented Apr 12, 2022

I am fine handpicking the API for embedder but I wonder how we could validate the correctness of the API then: we need to ensure we implement the API also in the workbench to get type failures early. In other words, we cannot just hand craft a d.ts file and not validate it with our actual code. I think vscode.d.ts does that.

@jrieken
Copy link
Member

jrieken commented Apr 13, 2022

Yeah, we explicitly implement the API in src/vs/workbench/api/common/extHost.api.impl.ts, we define a type which is of the vscode-module here:

@bpasero
Copy link
Member Author

bpasero commented Nov 9, 2022

@joaomoreno pointed out this tool which maybe could help: https://api-extractor.com/

Naive first run and error: microsoft/rushstack#3738

@bpasero bpasero self-assigned this Nov 9, 2022
@microsoft microsoft unlocked this conversation Nov 9, 2022
@bpasero bpasero removed their assignment Nov 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features or functionality web Issues related to running VSCode in the web
Projects
None yet
Development

No branches or pull requests

5 participants