diff --git a/news/2 Fixes/7249.md b/news/2 Fixes/7249.md new file mode 100644 index 00000000000..80d9276f515 --- /dev/null +++ b/news/2 Fixes/7249.md @@ -0,0 +1 @@ +Code cell submissions should go to active window in 'multiple' mode. \ No newline at end of file diff --git a/src/client/datascience/interactive-window/interactiveWindow.ts b/src/client/datascience/interactive-window/interactiveWindow.ts index 996263b5700..6bba671f94e 100644 --- a/src/client/datascience/interactive-window/interactiveWindow.ts +++ b/src/client/datascience/interactive-window/interactiveWindow.ts @@ -22,7 +22,8 @@ import { TextEditorRevealType, ViewColumn, NotebookEditor, - Disposable + Disposable, + window } from 'vscode'; import { IPythonExtensionChecker } from '../../api/types'; import { @@ -55,8 +56,7 @@ import { IInteractiveWindowInfo, IInteractiveWindowLoadable, IJupyterDebugger, - INotebookExporter, - WebViewViewChangeEventArgs + INotebookExporter } from '../types'; import { createInteractiveIdentity, getInteractiveWindowTitle } from './identity'; import { generateMarkdownFromCodeLines } from '../../../datascience-ui/common'; @@ -203,6 +203,13 @@ export class InteractiveWindow implements IInteractiveWindowLoadable { } this._notebookEditor = notebookEditor; this.notebookDocument = notebookEditor.document; + this.internalDisposables.push( + window.onDidChangeActiveNotebookEditor((e) => { + if (e === this._notebookEditor) { + this._onDidChangeViewState.fire(); + } + }) + ); this.listenForControllerSelection(notebookEditor.document); this.initializeRendererCommunication(); return notebookEditor; @@ -538,10 +545,6 @@ export class InteractiveWindow implements IInteractiveWindowLoadable { return undefined; } - protected async onViewStateChanged(_args: WebViewViewChangeEventArgs) { - this._onDidChangeViewState.fire(); - } - protected get notebookMetadata(): Readonly | undefined { return undefined; }