diff --git a/packages/plugin-ext/src/main/browser/editors-and-documents-main.ts b/packages/plugin-ext/src/main/browser/editors-and-documents-main.ts index 00a104e4a30d7..743d5ac664984 100644 --- a/packages/plugin-ext/src/main/browser/editors-and-documents-main.ts +++ b/packages/plugin-ext/src/main/browser/editors-and-documents-main.ts @@ -317,7 +317,7 @@ class EditorAndDocumentStateComputer implements Disposable { } let activeId: string | null = null; - const activeEditor = MonacoEditor.getCurrent(this.editorService); + const activeEditor = MonacoEditor.getCurrent(this.editorService) ?? this.cellEditorService.getActiveCell(); const editors = new Map(); for (const widget of this.editorService.all) { @@ -340,6 +340,9 @@ class EditorAndDocumentStateComputer implements Disposable { if (editor.getControl()?.getModel()) { const editorSnapshot = new EditorSnapshot(editor); editors.set(editorSnapshot.id, editorSnapshot); + if (activeEditor === editor) { + activeId = editorSnapshot.id; + } } };