-
Notifications
You must be signed in to change notification settings - Fork 29.3k
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 exploration #86632
Notebook exploration #86632
Conversation
Am I interpreting this correctly, that you are planning to add support for Jupyter notebooks into the base product? That would be awesome! I'm one of the two folks maintaining the Julia extension for VS Code, and there would be a huge demand for an ability to use Jupyter notebooks that have Julia code inside them. I'd be happy to be the point person from the Julia side to make sure this works with Julia. I just tried to compile this branch, but it errored. Maybe you could ping me when this branch is in a state where it might make sense to start testing it with Julia? Also feel free to reach out if you have any other questions re Julia and how we could make sure it works well with this work here. |
c226257
to
23a83ca
Compare
@davidanthoff sorry that I missed your comment as GitHub somehow hides the comment automatically for me ;( We are not trying to embed Jupyter notebook into the core. Instead the exploration we are doing here is to see if we can add a general performant and secure notebook rendering in the core and then extensions can contribute their Notebook implementation, thus one extension can implement Jupyter notebook support on top of the work we did here.
AFAIK, to make this happen, you need to implement a Julia kernel for Jupyter notebook first (it seems there is already one listed in https://github.com/jupyter/jupyter/wiki/Jupyter-kernels). Once that happens, you can use any Jupyter frontend to talk to the Julia kernel. |
Ah, that also sounds great :) So essentially someone (you guys?) should revive https://marketplace.visualstudio.com/items?itemName=donjayamanne.jupyter once the support for notebook rendering is in the core. Maybe more of a side point, but I think having Jupyter notebook support in the Python extension is really not in the spirit of the Jupyter project and very much not how all the other Jupyter Notebook clients are working right now (JupyterLab, nteract etc.). So I really hope the Jupyter proper extension will come back into existence, so that this feature doesn't live in a language specific extension :) Yes, Julia has had a Jupyter kernel for ages (in fact the "Ju" part in "Jupyter" stands for Julia). I was really just referring to having Jupyter notebook support that works with the existing Julia kernel inside VS Code, that would be super popular. |
Add a toolbar with some basic actions
…wModel and CodeViewModel
'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'hr', 'i', 'img', 'ins', 'kbd', 'li', 'main', 'mark', | ||
'ol', 'p', 'pre', 'section', 'span', 'strike', 'strong', 'sub', 'summary', 'sup', 'table', | ||
'tbody', 'td', 'th', 'thead', 'tr', 'u', 'ul', 'input' | ||
], |
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.
This is risky, right? Don't we use this function to also render extension contributed markdown and thereby also allowing them to render html?
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.
Thanks for the remind. This one is about allowing the core markdown renderer to display checkbox
which is sanitized by insane
. I'll revert the change for now and see ppl's feedback.
This PR covers the work behind #84293
Annotaions
Currently we track all features for a decent generic notebook client implementation in https://github.com/rebornix/notebook-test/blob/master/roadmap.ipynb and this PR tracks the work we have done to prove the ideas. While we continue to checking off the feature list, we also need to move away from workarounds in the code base to ensure that the code is mergeable.
isRendering
statebody
height/width100%
wheel
event handlerEvent for initial layout (for dimensions info)The ultimate goal is we send PRs to feature owners and get them merged before this PR>
Legacy todo list and notes
Old todo list
The feature list below is now tracked in https://github.com/rebornix/notebook-test/blob/master/roadmap.ipynb .
TOC
.ipynb
file directly from disk and parse the JSON content. The content might be contributed through API.python
, it should be contributed by notebook/cell metadata.Notes
Virtualization
To ensure that notebooks' file loading and scrolling is performant (see benchmarks and analysis in rebornix/notebook-test#1), we adopted List View to provide virtualization to cells in a notebook. Every cell in a notebook is rendered as a list item which has dynamic height.
To render a list view with dynamic height items, the List View will do following steps
The pre-calculate step is costly, especially when the DOM structure is complex, as it adds the item to the DOM tree once and then removes it. For code cells which are rendered as Monaco Editor, the pre-calculate step might take hundreds of milliseconds, which is noticeable when scrolling.
💪 We may want to have a smarter dynamic height calculation in List View.
Output rendering
Outputs for code cell execution come in various formats, including text, errors, png images, svg or even html. Text and PNGs can be rendered in a control way but svg/html contents are more abitrary so we might need to render in sandboxed iframes or webview to avoid them misbehaving.
Code cell language/debugging support
For every visible code cell, we create a text model with preferred language (
python
at this moment) and attach it to a monaco editor. Extensions will see it as a regularvscode.TextDocument
and stored in memory. Extensions which rely on file system might break in this case.The other catch is monaco editors in the same notebook share the same tab and editor group. How would document based operations work? What should happen when users run Go To Definition?
The same problem applies to Debugging too as currently debuggers work on files/documents, but not fragments.