PNE debugging: F5 routing, no-kernel errors, and premature session termination#13807
Open
rodrigosf672 wants to merge 2 commits into
Open
PNE debugging: F5 routing, no-kernel errors, and premature session termination#13807rodrigosf672 wants to merge 2 commits into
rodrigosf672 wants to merge 2 commits into
Conversation
Route F5 to native notebook debugging when Positron Notebook Editor is active, bypassing CONTEXT_DEBUGGERS_AVAILABLE which blocked activation. When no kernel is connected, open the kernel picker instead of producing a launch config error or unclear dialog. Keep the debug session alive after cell execution and allow re-invoking Debug Cell during an active session without error. Fixes #12845, #10226, #10231.
|
E2E Tests 🚀 |
This was
linked to
issues
May 27, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR improves Positron notebook debugging UX by routing F5 to the native notebook debug flow in the Positron Notebook Editor, handling “no kernel” scenarios more gracefully, and allowing Debug Cell to be re-invoked during an active session without prematurely terminating that session.
Changes:
- Add a Positron-specific F5 keybinding that starts notebook debugging (or opens the kernel picker when debugging isn’t available).
- Update the runtime debugger extension to keep notebook debug sessions alive after cell execution and allow “Debug Cell” re-entry.
- Add Playwright E2E coverage for the reported regressions and expected routing behavior.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
test/e2e/tests/notebooks-positron/notebook-debug-fixes.test.ts |
New E2E tests covering F5 routing, no-kernel behavior, and Debug Cell re-entry. |
src/vs/workbench/contrib/debug/browser/debugCommands.ts |
Adds a Positron-specific F5 keybinding override when the Positron notebook editor is active. |
extensions/positron-runtime-debugger/src/notebookDebugService.ts |
Reuses an existing notebook debug session by executing cells instead of starting a new session. |
extensions/positron-runtime-debugger/src/notebookDebugAdapterFactory.ts |
Adjusts “already debugged” tracking behavior when creating adapters. |
extensions/positron-runtime-debugger/src/debugCellController.ts |
Keeps debug session alive after cell execution completes. |
extensions/positron-runtime-debugger/package.json |
Enables notebook.debugCell whenever the runtime supports debugging (removes “resource not in debuggedNotebooks”). |
Comment on lines
+85
to
+88
| /** Check if a debug session is active for the given notebook URI. */ | ||
| function hasActiveDebugSessionForNotebook(notebookUriStr: string): boolean { | ||
| return vscode.debug.activeDebugSession?.configuration?.__notebookUri === notebookUriStr; | ||
| } |
Comment on lines
+66
to
+71
| if (hasActiveDebugSessionForNotebook(notebookUriStr)) { | ||
| await vscode.commands.executeCommand('notebook.cell.execute', { | ||
| ranges: [{ start: getCellIndex(cell), end: getCellIndex(cell) + 1 }], | ||
| document: cell.notebook.uri, | ||
| }); | ||
| return; |
Comment on lines
+90
to
+111
| /** Get the cell index, handling both NotebookCell and PositronContext. */ | ||
| function getCellIndex(cell: vscode.NotebookCell | PositronContext): number { | ||
| if (isNotebookCell(cell)) { | ||
| return cell.index; | ||
| } | ||
| const notebook = vscode.workspace.notebookDocuments.find( | ||
| (doc) => doc.uri.toString() === cell.notebook.uri.toString() | ||
| ); | ||
| if (notebook) { | ||
| const idx = notebook.getCells().findIndex( | ||
| (c) => c.document.uri.toString() === cell.document.uri.toString() | ||
| ); | ||
| if (idx >= 0) { | ||
| return idx; | ||
| } | ||
| } | ||
| return 0; | ||
| } | ||
|
|
||
| function isNotebookCell(cell: vscode.NotebookCell | PositronContext): cell is vscode.NotebookCell { | ||
| return typeof (cell as vscode.NotebookCell).index === 'number'; | ||
| } |
Comment on lines
+30
to
33
| // Clear any stale tracking from a previously terminated session. | ||
| if (this._debuggedNotebookUris.has(notebookUri)) { | ||
| throw new Error(vscode.l10n.t('Unexpected error: Notebook {0} is already being debugged', notebookUri.toString())); | ||
| await this._debuggedNotebookUris.delete(notebookUri); | ||
| } |
| const errorNotification = page.locator('.notifications-toasts .notification-toast'); | ||
| const count = await errorNotification.count(); | ||
| for (let i = 0; i < count; i++) { | ||
| const text = await errorNotification.nth(i).textContent(); |
| // No error modal dialog | ||
| const dialog = page.locator('.monaco-dialog-box .dialog-message'); | ||
| if (await dialog.isVisible()) { | ||
| const text = await dialog.textContent(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CONTEXT_DEBUGGERS_AVAILABLEwhich blocked activation (Positron Notebooks: Clicking on Debugging should open the native notebook debugging experience #12845)${file}launch config error (Positron Notebooks - When NO kernel is selected and user attempts to 'Run and Debug', dialog with unrelated message appears #10226) or an unclear dialog (Attempting to run debug cell from right button with kernel unselected leads to unclear dialog #10231)Test plan
npx playwright test test/e2e/tests/notebooks-positron/notebook-debug-fixes.test.ts --project e2e-electron@:web @:win @:debug @:positron-notebooks