提交 7e3d5a0c 编写于 作者: R rebornix

fix #114048. do not update active kernel if kernel is executed.

上级 c7cf663d
......@@ -146,6 +146,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
return this._notebookViewModel?.notebookDocument;
}
private _activeKernelExecuted: boolean = false;
private _activeKernel: INotebookKernelInfo2 | undefined = undefined;
private readonly _onDidChangeKernel = this._register(new Emitter<void>());
readonly onDidChangeKernel: Event<void> = this._onDidChangeKernel.event;
......@@ -733,6 +734,8 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
this._webview?.element.remove();
this._webview = null;
this._list.clear();
this._activeKernel = undefined;
this._activeKernelExecuted = false;
}
async beginComputeContributedKernels() {
......@@ -755,6 +758,11 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
return;
}
if (this._activeKernel !== undefined && this._activeKernelExecuted) {
// kernel already executed, we should not change it automatically
return;
}
const provider = this.notebookService.getContributedNotebookProvider(this.viewModel.viewType) || this.notebookService.getContributedNotebookProviders(this.viewModel.uri)[0];
const availableKernels = await this.beginComputeContributedKernels();
......@@ -1766,6 +1774,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
}
await this._ensureActiveKernel();
this._activeKernelExecuted = true;
await this._activeKernel?.executeNotebookCell!(this.viewModel.uri, undefined);
}
......@@ -1806,6 +1815,7 @@ export class NotebookEditorWidget extends Disposable implements INotebookEditor
}
await this._ensureActiveKernel();
this._activeKernelExecuted = true;
await this._activeKernel?.executeNotebookCell!(this.viewModel.uri, cell.handle);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册