Change:
It's easy to lose track of the debugged cell in notebooks, especially when you've stepped into a cell which is different from the cell that is "running". Some improvements we could make: The "Go To" button should go to the cell at the top of the callstack, not the cell where the user clicked Run We should show overview ruler decorations for the top stackframe, as in the editor And overview ruler decorations for the currently running cell And for breakpoints (behind a setting, ) cc
To verify, just try everything listed at the top. For I mean, have two cells, like and a second cell that calls . Set a breakpoint in the function definition, click run on the second cell, and make sure "Go To" goes to that first cell where the instruction pointer is.

Discussion:
import { Iterable } from 'vs/base/common/iterator'; import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; <del> import { UriComponents } from 'vs/base/common/uri'; </del> <ins> import { URI, UriComponents } from 'vs/base/common/uri'; </ins> import { ILanguageService } from 'vs/editor/common/languages/language'; import { localize } from 'vs/nls'; import { MenuId, registerAction2 } from 'vs/platform/actions/common/actions';

import { NOTEBOOK_CELL_EXECUTING, NOTEBOOK_CELL_EXECUTION_STATE, NOTEBOOK_CELL_LIST_FOCUSED, NOTEBOOK_CELL_TYPE, NOTEBOOK_HAS_RUNNING_CELL, NOTEBOOK_INTERRUPTIBLE_KERNEL, NOTEBOOK_IS_ACTIVE_EDITOR, NOTEBOOK_KERNEL_COUNT, NOTEBOOK_KERNEL_SOURCE_COUNT, NOTEBOOK_LAST_CELL_FAILED, NOTEBOOK_MISSING_KERNEL_EXTENSION } from 'vs/workbench/contrib/notebook/common/notebookContextKeys'; import { CellEditState, CellFocusMode, EXECUTE_CELL_COMMAND_ID } from 'vs/workbench/contrib/notebook/browser/notebookBrowser'; import * as icons from 'vs/workbench/contrib/notebook/browser/notebookIcons'; <del> import { CellKind, NotebookSetting } from 'vs/workbench/contrib/notebook/common/notebookCommon'; </del> <ins> import { CellKind, CellUri, NotebookSetting } from 'vs/workbench/contrib/notebook/common/notebookCommon'; </ins> import { NotebookEditorInput } from 'vs/workbench/contrib/notebook/common/notebookEditorInput'; import { INotebookExecutionStateService } from 'vs/workbench/contrib/notebook/common/notebookExecutionStateService'; import { IEditorGroupsService } from 'vs/workbench/services/editor/common/editorGroupsService'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; import { Schemas } from 'vs/base/common/network'; <ins> import { IDebugService } from 'vs/workbench/contrib/debug/common/debug'; </ins> const EXECUTE_NOTEBOOK_COMMAND_ID = 'notebook.execute'; const CANCEL_NOTEBOOK_COMMAND_ID = 'notebook.cancelExecution';

const notebook = context.notebookEditor.textModel.uri; const executingCells = notebookExecutionStateService.getCellExecutionsForNotebook(notebook); if (executingCells[0]) { <del> const cell = context.notebookEditor.getCellByHandle(executingCells[0].cellHandle); </del> <ins> const topStackFrameCell = this.findCellAtTopFrame(accessor, notebook); const focusHandle = topStackFrameCell ?? executingCells[0].cellHandle; const cell = context.notebookEditor.getCellByHandle(focusHandle); </ins> if (cell) { context.notebookEditor.focusNotebookCell(cell, 'container'); } } } <ins> private findCellAtTopFrame(accessor: ServicesAccessor, notebook: URI): number | undefined { const debugService = accessor.get(IDebugService); for (const session of debugService.getModel().getSessions()) { for (const thread of session.getAllThreads()) { const sf = thread.getTopStackFrame(); if (sf) { const parsed = CellUri.parse(sf.source.uri); if (parsed && parsed.notebook.toString() === notebook.toString()) { return parsed.handle; } } } } return undefined; } </ins> }); registerAction2(class RevealLastFailedCellAction extends NotebookAction {