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

Notebook kernel source menu contribution #150146

Merged
merged 14 commits into from
May 24, 2022
Merged

Notebook kernel source menu contribution #150146

merged 14 commits into from
May 24, 2022

Conversation

rebornix
Copy link
Member

This PR is an API experiment for #146942 based on offline discussions with @jrieken . The idea is allowing extensions to contribute commands to the kernel picker list through menu contribution. This gives extensions the full capabilities of implementing proxy kernels, kernel servers, etc. The menu contribution can be replaced by real APIs if necessary (especially if we have quite some interops with other models in the notebook).

The code in this PR is large, but it's basically:

In addition to above, here are two typical workflows enabled:

Single source command

When there is only one single extension contributing a command to menu notebook/kernelSource, users will see that command in the kernel status bar item, as shown below

image

When users attempt to run cells, the core will run the command. When the command finishes execution (promise resolves), we will detect if there are notebook controllers created for current notebook, if there is a preferred one, pass the pending cell execution request to the controller, finish the cell execution.

Recording 2022-05-22 at 19 22 33

Mixed notebook kernels and kernel source commands

When we have multiple kernels and commands contributed by extensions, the kernel status bar item behaves the same as before, it will show the suggested/preferred kernel name if there is any.

When users click the kernel status item, we will show the kernel picker, which lists all available kernels and commands contributed to menu notebook/kernelSource. If users pick a command/action from notebook/kernelSource, the core will run the command. At the end, we might get more kernels/controllers contributed as a side effect of running the command. Users can then run cells as usual.

image

Recording 2022-05-22 at 19 24 00

@rebornix rebornix self-assigned this May 23, 2022
@VSCodeTriageBot VSCodeTriageBot added this to the May 2022 milestone May 23, 2022
Copy link
Member

@jrieken jrieken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good.Left a nit-comment. CI is failing, no approval because of that

roblourens
roblourens previously approved these changes May 23, 2022
Copy link
Member

@roblourens roblourens left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sweet

@rebornix rebornix enabled auto-merge May 24, 2022 01:05
@rebornix rebornix merged commit 27ea5e4 into main May 24, 2022
@rebornix rebornix deleted the rebornix/source-commands branch May 24, 2022 01:11
@github-actions github-actions bot locked and limited conversation to collaborators Jul 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants