diff --git a/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.ts b/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.ts index 4207532513f..b13e8fb2d25 100644 --- a/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.ts +++ b/src/vs/workbench/api/browser/mainThreadNotebookDocumentsAndEditors.ts @@ -7,6 +7,7 @@ import { diffMaps, diffSets } from 'vs/base/common/collections'; import { combinedDisposable, DisposableStore, DisposableMap } from 'vs/base/common/lifecycle'; import { URI } from 'vs/base/common/uri'; import { IInstantiationService } from 'vs/platform/instantiation/common/instantiation'; +import { ILogService } from 'vs/platform/log/common/log'; import { MainThreadNotebookDocuments } from 'vs/workbench/api/browser/mainThreadNotebookDocuments'; import { NotebookDto } from 'vs/workbench/api/browser/mainThreadNotebookDto'; import { MainThreadNotebookEditors } from 'vs/workbench/api/browser/mainThreadNotebookEditors'; @@ -99,6 +100,7 @@ export class MainThreadNotebooksAndEditors { @INotebookEditorService private readonly _notebookEditorService: INotebookEditorService, @IEditorService private readonly _editorService: IEditorService, @IEditorGroupsService private readonly _editorGroupService: IEditorGroupsService, + @ILogService private readonly _logService: ILogService, ) { this._proxy = extHostContext.getProxy(ExtHostContext.ExtHostNotebook); @@ -156,6 +158,7 @@ export class MainThreadNotebooksAndEditors { activeEditor = focusedEditor.getId(); } if (activeEditor && !editors.has(activeEditor)) { + this._logService.trace('MainThreadNotebooksAndEditors#_updateState: active editor is not in editors list', activeEditor, editors.keys()); activeEditor = null; } diff --git a/src/vs/workbench/api/common/extHostNotebook.ts b/src/vs/workbench/api/common/extHostNotebook.ts index 1b4063b5a0d..9d3dad48f0c 100644 --- a/src/vs/workbench/api/common/extHostNotebook.ts +++ b/src/vs/workbench/api/common/extHostNotebook.ts @@ -424,6 +424,10 @@ export class ExtHostNotebookController implements ExtHostNotebookShape { // clear active notebook as current active editor is non-notebook editor this._activeNotebookEditor = undefined; } else if (delta.value.newActiveEditor) { + const activeEditor = this._editors.get(delta.value.newActiveEditor); + if (!activeEditor) { + console.error(`FAILED to find active notebook editor ${delta.value.newActiveEditor}`); + } this._activeNotebookEditor = this._editors.get(delta.value.newActiveEditor); } if (delta.value.newActiveEditor !== undefined) {