mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 17:19:48 +01:00
fix #114048. do not update active kernel if kernel is executed.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user