Skip to content

Commit 06443bc

Browse files
authored
Double check IW is the notebook changing when handling scroll events (microsoft#155095)
* Fix 155092 * Review feedback
1 parent 6a900fc commit 06443bc

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/vs/workbench/contrib/interactive/browser/interactiveEditor.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ import { INotebookExecutionStateService } from 'vs/workbench/contrib/notebook/co
5757
import { NOTEBOOK_KERNEL } from 'vs/workbench/contrib/notebook/common/notebookContextKeys';
5858
import { ICursorPositionChangedEvent } from 'vs/editor/common/cursorEvents';
5959
import { IExtensionService } from 'vs/workbench/services/extensions/common/extensions';
60+
import { isEqual } from 'vs/base/common/resources';
6061

6162
const DECORATION_KEY = 'interactiveInputDecoration';
6263
const INTERACTIVE_EDITOR_VIEW_STATE_PREFERENCE_KEY = 'InteractiveEditorViewState';
@@ -152,9 +153,11 @@ export class InteractiveEditor extends EditorPane {
152153
codeEditorService.registerDecorationType('interactive-decoration', DECORATION_KEY, {});
153154
this._register(this.#keybindingService.onDidUpdateKeybindings(this.#updateInputDecoration, this));
154155
this._register(this.#notebookExecutionStateService.onDidChangeCellExecution((e) => {
155-
const cell = this.#notebookWidget.value?.getCellByHandle(e.cellHandle);
156-
if (cell && e.changed?.state) {
157-
this.#scrollIfNecessary(cell);
156+
if (isEqual(e.notebook, this.#notebookWidget.value?.viewModel?.notebookDocument.uri)) {
157+
const cell = this.#notebookWidget.value?.getCellByHandle(e.cellHandle);
158+
if (cell && e.changed?.state) {
159+
this.#scrollIfNecessary(cell);
160+
}
158161
}
159162
}));
160163
}

0 commit comments

Comments
 (0)