diff --git a/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.ts b/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.ts index de2048c037a73213e589421f3b35d8781afa0c34..0a9ea7d3cc4e35a60b32516937d02cfa81682409 100644 --- a/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.ts +++ b/src/vs/workbench/contrib/notebook/browser/contrib/editorStatusBar/editorStatusBar.ts @@ -98,20 +98,18 @@ registerAction2(class extends Action2 { const logService = accessor.get(ILogService); const viewletService = accessor.get(IViewletService); - let editor; - if (context !== undefined) { - if ('notebookEditorId' in context) { - const editorId = context.notebookEditorId; - const matchingEditor = editorService.visibleEditorPanes.find((editorPane) => { - const notebookEditor = getNotebookEditorFromEditorPane(editorPane); - return notebookEditor?.getId() === editorId; - }); - editor = getNotebookEditorFromEditorPane(matchingEditor); - } else if ('notebookEditor' in context) { - editor = context?.notebookEditor; - } else { - editor = getNotebookEditorFromEditorPane(editorService.activeEditorPane); - } + let editor: INotebookEditor | undefined; + if (context !== undefined && 'notebookEditorId' in context) { + const editorId = context.notebookEditorId; + const matchingEditor = editorService.visibleEditorPanes.find((editorPane) => { + const notebookEditor = getNotebookEditorFromEditorPane(editorPane); + return notebookEditor?.getId() === editorId; + }); + editor = getNotebookEditorFromEditorPane(matchingEditor); + } else if (context !== undefined && 'notebookEditor' in context) { + editor = context?.notebookEditor; + } else { + editor = getNotebookEditorFromEditorPane(editorService.activeEditorPane); } if (!editor || !editor.hasModel()) {