Skip to content

API for kernel selection in REPL editors (SetReplKernelAffinity) #254752

@amunger

Description

@amunger

Currently kernels are auto selected manually by the extension that creates the REPL with the selectKernel command. We want to change that to have more separation between REPL creation and kernel selection.

We avoid auto-selecting kernels for notebooks, but we need to for REPLs so that the code can run without requiring the user to go through kernel selection.

scenarios to support

a REPL is created by an extension (e.g. python: start native REPL)

  • we should allow auto-selecting that extension's kernel created specifically for that kernel
    • user installs python ext and runs create native REPL -> python REPL should be selected
  • users should also be able to select a different kernel
    • user runs python extension's create native REPL and selects jupyter kernel
      • closing and creating a new REPL should select the jupyter kernel again
      • it should be easy to switch back to using python's REPL kernel (suggested and surfaced as an immediate choice)
  • ?? other extensions should be able to create a kernel specific to a certain kind of REPL
    • 3rd party makes a higher fidelity Python REPL kernel and wants to have it selected for REPLs created by python extension

Python and Jupyter both create REPLs for python - each should have their respective kernels be auto-selected by default

implementation

new API - SetReplKernelAffinity (we currently have SetNotebookKernelAffinity)

  • only applies to REPLs, so doesn't affect notebook kernel selection
  • document selector (language, notebookType) or URI/notebookDocument
    • REPL creators should set the language info on the backing notebook Document for the selection to work
    • setting affinity to a notebookDocument would only affect kernel selection for that document
      • untitled-1.ipynb will be re-used, and should not keep the kernel affinity

REPL editors can use the MRU kernel picker logic to re-use previously selected kernels, but should be based on the document properties (likely just language and notebookType). REPL editors cannot currently be used for saved files, but could use the URL in that case.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions