From 3d6c4d186383a1fd4d2f8d526bd1cfd9ff8e1937 Mon Sep 17 00:00:00 2001 From: Jonah Iden Date: Fri, 8 Nov 2024 13:16:45 +0100 Subject: [PATCH] Fix active notebook editor staying active as long as the editor is active Signed-off-by: Jonah Iden --- .../src/main/browser/editors-and-documents-main.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; + } } };