-
Notifications
You must be signed in to change notification settings - Fork 294
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
Review API JupyterServerProvider and prepare for stable API #13936
Conversation
7138823
to
c71153c
Compare
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.
@DonJayamanne Can you share a code example of how you'd use this API?
My overall impression is that the flow of the API seems a little strange. Typically APIs like this fit into one of two models:
- A pull model. Callers register providers that the host then calls
- A push model. Callers call functions to modify a managed collection
This seems closer to the push model but I don't currently understand why all the create*
functions are needed. It would help to know which objects are meant to be manage/live and which ones are simply meant to contain data
I'd also be interested to see if we could use a provider model instead as this gives the host more control
* @return {*} {JupyterServerCollection} | ||
* @memberof JupyterAPI | ||
*/ | ||
createServerCollection(id: string, label: string): Promise<JupyterServerCollection>; |
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.
Are collections scoped to the extension? For instance, what happens if two extensions use the same id
?
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.
Yes they are scoped to the extension,
I discussed with Peng the old code requires it to be unique (i.e. if another extension uses the same id, then that could result in problems), but I guess thats a problem that we need to fix.
So, lets go with unique per extension, which is my preference.
However, the challenge here is we need to know the caller (extension), today we get this information by analyzing the stack trace.
Here is the sample repo using the new API If you look at the commit history, the first commit shows how the old API is used (lot more complex,. and used a provider model and had access to qujick picks as well, no real domain model) 1. This is the standard kernel picker (built by VS Code)2. From previous quick pick user selects the option
|
53abe3b
to
01c3fd8
Compare
Thanks @DonJayamanne! Based on your description of the flow, it seems like a pull model may be a better fit. Have you consider a more "provider like" approach? |
@mjbvz thanks, we did have a provider style API earlier (with quick picks), will try to get that again and pass it your way. |
01c3fd8
to
86da862
Compare
hi @mjbvz we decided to go with a push model as the UI and requirements are similar to notebook controllers. Hence prefer to go with the push, however I have updated this PR by adding another file with the pull (provider) model API. See here https://github.com/microsoft/vscode-jupyter/blob/86da8624cbff9a9cee0844642b848bd4637472bf/src/api.proposed.d.ts Will bring this to the next API discussion. |
86da862
to
33eb90c
Compare
33eb90c
to
4df74a5
Compare
Closing this PR as most of the issues ahve been addressed. |
For #13894