-
Notifications
You must be signed in to change notification settings - Fork 34.3k
Closed
Labels
feature-requestRequest for new features or functionalityRequest for new features or functionalitynotebookon-testplan
Milestone
Description
The current plan is to support both real debugging and "run by line" in Jupyter. "Run by line" is a simple debug mode that only allows stepping through the code of a single cell. It will be backed by a real debug session but with some debug UI in VS Code disabled.
Basic debugging questions/tasks
- Enable cell breakpoint margin in a notebook
- Show an explicit button to show the breakpoint margin. The debugger contribution could say that it supports notebooks of some type (similar to the
languages
property on the debugger contribution), which enables this action. - I need to be able to set breakpoints before I run a cell, and I don't want to show the breakpoint margin all of the time, so we need this mode.
- Show an explicit button to show the breakpoint margin. The debugger contribution could say that it supports notebooks of some type (similar to the
- How does a debug session start?
- No launch config
- We have discussed two concepts: starting a long running debug session, or a "run and debug" button that starts a debug session just for the time a cell is being debugged. Sounds like people generally prefer the second.
- However, we need to have this "show breakpoint margin" mode, and we could also just combine these into a single "debugging enabled" mode which is pretty much how jupyter lab works. With this enabled, the normal run button hits breakpoints. I think it's more confusing to have a separate button to "run and debug". If I set a breakpoint and want to run the cell, why do I have to go find a different run button? Do I also need "run and debug all" or "run and debug cells below", etc.?
- I think that ideally, VS Code would manage the experience to start debugging, and would find and invoke the proper DA, but for now, we should have the extension do all of this until we figure out what the experience should actually look like, which would drive vscode/api changes.
- The extension also can dynamically check whether the kernel supports debugging. If VS Code owns the start debugging experience, this needs to be surfaced.
- The controller could set a
debugAdapter
property which tells us the ID of a debug adapter that can debug the active kernel. If it's undefined, debugging is not enabled.
- The controller could set a
- The work to implement the debug adapter, talk to ipykernel, and jupyter-specific things Native Notebooks - Run by Line vscode-jupyter#5607
- Restore breakpoints to correct cell when URIs change after closing/reopening notebook
- The prototype repo has a fix for this in the extension, but vscode should do this automatically for all notebooks, maybe by saving the cell index with the breakpoint itself, or just by having some notebook contrib that moves them around.
- Is it bad that the timer runs when paused?
- Can pause it, but the start/end times in the API will still reflect the paused time. We could just hide this and not persist the duration when pausing in a cell.
[ ] Variables pane vs debug variables view[ ] The debug console vs interactive pane[ ] Figure out how debugging across different kernel types would work- If dotnet interactive and julia implemented DAP with the same extensions as Jupyter, the same debug adapter could be used - https://jupyter-client.readthedocs.io/en/stable/messaging.html#additions-to-the-dap
- But then where does the debug adapter extension live, and how does it acquire the connection to the kernel?
- It is probably easier to have separate debug adapters that live next to the extension code that has a connection to the kernel, we can share code with a library. However it was mentioned that this same problem basically exists with the "restart kernel" command which is pretty much the same across different kernel types but can't be contributed by a single extension without a way to get the kernel connection for other controllers.
- We are focusing on python and the kernels provided by the vscode-jupyter extension
[ ] Should we put cells in readonly mode when paused?
Run by line tasks
- Start a debug session when the "run by line" button is clicked
- The extension will do this with
vscode.debug.startDebugging
- The extension will do this with
- Ability to start a debug session in "simple mode" which "run by line" will enable. In "simple mode", the window statusbar will not change color, the debug widget will not appear, and the debug viewlet will not be shown. Everything else can remain the same.
- How do we start a debug session in "simple mode"? We can make it part of the debug adapter's "capabilities", or a launch config prop read by vscode, or a flag on
DebugSessionOptions
. I think the first is preferable, but will there be debug UI shown before we get the capabilities? - My thinking is that "run by line" will not be a feature that all notebooks get out of the box, but something that an extension can implement using the "simple mode" flag, toolbar contributions, and other basic vscode API, because I am not sure that every notebook type in the world would agree on the details.
- How do we start a debug session in "simple mode"? We can make it part of the debug adapter's "capabilities", or a launch config prop read by vscode, or a flag on
https://excalidraw.com/#json=5721711802580992,GeAhnXz10-VKb53A9XmgNA
Metadata
Metadata
Assignees
Labels
feature-requestRequest for new features or functionalityRequest for new features or functionalitynotebookon-testplan