Skip to content

Builtin interactive window support #126415

@rebornix

Description

@rebornix

Explore how to replace the webview interactive in Jupyter extension with a built in one with better workbench integration and leverage the existing notebook ecosystem.

Prototype

  • Core
    • ctrl+enter on the code editor widget as a command/kb: interacive.execute
      • execute, get active text editor, get the content, find the notebook document, apply worksapce edit
      • request execution on cell notebook.cell.execute (argument is CellRange)
    • Make this document readonly
    • setting interactive.experiments.enable
    • Swap menu ids for interactive editor (notebook/toolbar to interactive/toolbar)
  • Jupyter
    • register controllers for interactive
    • contribute commands/codelens when config.interactive.experiments.enableBuiltinEditor == true
    • remove decorations for cell editors in the interactive window
    • when a controller is selected by the document, then insert a markdown cell
    • collapse all cell inputs by default

Snapshot of how it looks integrated together:

image

Issues unveiled from prototype:

  • Affinity doesn't always work, might be caused by no activeNotebokkEditorChange event.
  • register intellisense for input editor. This would require some rewrite as it will need to read the NotebookDocument in the IW.
  • Variables View is global and depends on activeNotebook
  • Initial kernel/sys info: in traditional interactive window / repl, when the window/repl is started, there is a printed message about the environment (e.g., Python 3.8, balabal). The info is only known after the underling jupyter kernel is started, so if users open Interactive Window first, and shift+enter to execute code from the input editor, we insert a code cell first before the kernel gets a change to print the kernel info.

Backlog

  • Core

    • Customized theme tokens for notebook in the interactive window
    • Improve styles for input editor in interactive window
    • Clearer UI indication that interactive window is readonly (e.g. cell editor background color, no drag and drop feedback)
    • Collapsed cell input for code cells submitted from a script file, with just the first line of code shown
  • Jupyter

    • Implement variables view
    • Interactive window multiple, single, perFile settings
    • Preserve #%% comments in cell metadata and restore during export
    • IPyWidgets support
    • Merge exporting to notebook with existing quickpick
    • Debug cell
    • Support executing markdown cells from a script file in the interactive window
    • Support exporting markdown cells from interactive window (preserving language, cell type etc)
    • Add a setting to export to Python script without preserving cell delimiters
    • Suppress language server intellisense for TextDocuments in embedded NotebookDocuments (handled by the core)

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions