-
Notifications
You must be signed in to change notification settings - Fork 29.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
Create EmbedderApiRegistry to construct web API for vscode-dev consumers #147728
Conversation
I believe it's still useful to have the embedder API defined as an interface somewhere, as we still need it to use in consumers, but use contributions to add to it. In here we have an empty Also, I think the registered instances can implement the prescribed interface themselves, not sure there's a benefit to nesting it in a property. |
…types to contributors
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.
I think this is starting to look good, though Ben is the expert here. Probably some opportunities to reduce duplication 🙂
@@ -38,6 +38,54 @@ export interface IWorkbench { | |||
executeCommand(command: string, ...args: any[]): Promise<unknown>; | |||
}; | |||
|
|||
progress: { |
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.
Hm, I wonder if we can pull this file in versus re-declaring it as the IEmbedderApi
?
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.
Hm I think if we move where the Web API sits this would be possible. Currently it complains about import rules when I tried to import it directly.
*/ | ||
export const telemetryLevel: Promise<IObservableValue<TelemetryLevel>> = | ||
workbenchPromise.p.then(workbench => workbench.telemetry.telemetryLevel); | ||
} |
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.
I wonder if these could these be created as an object that's automatically exported, to reduce duplication of having to redefine the API here
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.
This would be nice yeah. @bpasero curious if you had thoughts here
🆒 , will do a full review tomorrow, some high level things:
|
After moving the embedder contributions to a singe file |
c86fe7b
to
0890ea6
Compare
0890ea6
to
4ce1481
Compare
Sorry for the confusion but I had actually liked the approach of contributing to this new registry from the location of where the component is. The idea of registries are to decouple the components that contribute from each other. If for example we decide to expose an embedder API for the terminal component later on, the This is somewhat similar/related to our extension API in @jrieken as the creator of But I think even for extension API it would be nice if respective components could provide the API implementation in a contribution style. |
The registry approach seems a tad over-engineered to me. I see how it keeps things in "their places", e.g folders, but I don't believe we plan for having multiple implementations of one API slice or that we would ever ship with a partial API. The way our API facades work is that they are a "pretty focal point" of everything. |
Fair enough. I think this maybe deserves a bit of more discussion to come to a solution how the embedder API shape is going to be in the future. Ideally we can put all the problems with our current solution on the table and find a good solution, so far I see:
Can we move this to May then and plan for it? Otherwise if the API is really needed now, then I suggest to just throw it into the current format and have it cleanup later. We just have to make sure that we remain the only ones using it if we are going to change it later. |
It would be nice to get in the embedder logger for this iteration. I can reopen my older PR which used the current format of how the API is constructed and we can see in the May iteration how to best refractor the embedder API? |
Re: #147035 and https://github.com/microsoft/vscode-dev/issues/555
This PR:
Creates a EmbedderApiRegistry that individual API components will register to to create final web API shape defined in
web.api.ts
Separate out env into individual components but maintain backwards compat. @connor4312 and I thought that env seemed like a random assortment of functions and with the web API we can split them up.
The final shape of IWorkbench: (open for feedback)
Question:
@sandy081 with this refractoring would it be possible to move the Output code intovs/platform/output/common
? I'm getting another error with the pre-commit check after my refactoring:where it's upset that output lives inworkbench/services