positron icon indicating copy to clipboard operation
positron copied to clipboard

Epic: Positron Notebook Editor Basic

Open nstrayer opened this issue 1 year ago • 2 comments

What?

A new editor for notebook applications. The "basic" setup will be the minimum needed for a functional notebook experience. This won't necessarily result in a better notebook experience than the built-in vscode notebooks, but will be the foundation for building off of to create a better experience.

Steps

  • [x] Prototype getting a basic notebook editor working and running .ipynb files using React
  • [x] Hook up Monaco editors to React UI
  • [ ] Add first-party output support for common output types
    • [x] PNGs
  • [ ] Add support for contributed output types using the existing contribution interface for notebooks
  • #2353
  • #2350
  • #2355
  • #2357
  • #2354
  • #2351

nstrayer avatar Feb 14 '24 22:02 nstrayer

One feature that came up today is the ability for YAML autocompletion and validation to work within the Notebook editor. RStudio and Quarto's VS code extension do stuff like this:

image

The validation uses precisely the same schema as the command line, and it also drives auto-completion when appropriate, again from the same sources:

image

The Positron notebook editor can, at least in principle, detect Quarto metadata blocks, and it would be nice for it to provide the same affordances.

This code is sort of factored out already in a way that is accessible to RStudio and VS Code both. It's not pretty, but the way this works is that quarto-cli bundles (among other things) a Javascript file that has an API for querying completions and validations. Since the VS code extension and RStudio both know where quarto is, they can access this file, and they know how to call it.

The files are all in ./src/resources/editor/tools/yaml/ inside a bundle, as well as https://github.com/quarto-dev/quarto-cli/tree/main/src/resources/editor/tools/yaml. The entry points themselves are:

https://github.com/quarto-dev/quarto-cli/blob/05295257c854214900910847cf6bc4faf7ecdcf1/src/resources/editor/tools/yaml/yaml-intelligence.js#L98

This is all messy (insert banana guy meme here), but a pairing session should be enough for y'all to get your bearings.

cscheid avatar Aug 21 '24 23:08 cscheid

Another thing that the VS code editor does is auto-completion for some Markdown constructs directly:

image

This would also be nice to have support for in the Notebook editor. These completions are defined in

https://github.com/quarto-dev/quarto-cli/blob/05295257c854214900910847cf6bc4faf7ecdcf1/src/resources/editor/tools/attrs.yml

And they are used by the VS Code extension in

https://github.com/quarto-dev/quarto/blob/b6c819b0b3649d6011a8fff06532107b5a3ebbab/apps/lsp/src/quarto.ts#L84-L162

cscheid avatar Aug 21 '24 23:08 cscheid

The new Positron Notebook should be able to allow multiple languages, so it is on par with Quarto document

ntluong95 avatar Aug 18 '25 12:08 ntluong95

Closing, we've completed all but one issue 🎉 which we can track separately

seeM avatar Oct 01 '25 13:10 seeM