Skip to content

Commit

Permalink
fix kernel autobind for on startup opened notebooks
Browse files Browse the repository at this point in the history
Signed-off-by: Jonah Iden <jonah.iden@typefox.io>
  • Loading branch information
jonah-iden committed Apr 12, 2024
1 parent 32f393a commit 73dab6f
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -209,9 +209,16 @@ export class NotebookKernelsMainImpl implements NotebookKernelsMain {
}
}(handle, data, this.languageService);

// this is for when a kernel is bound to a notebook while being registered
const autobindListener = this.notebookKernelService.onDidChangeSelectedKernel(e => {
if (e.newKernel === kernel.id) {
this.proxy.$acceptNotebookAssociation(handle, e.notebook.toComponents(), true);
}
});

const registration = this.notebookKernelService.registerKernel(kernel);
this.kernels.set(handle, [kernel, registration]);

autobindListener.dispose();
}

$updateKernel(handle: number, data: Partial<NotebookKernelDto>): void {
Expand Down

0 comments on commit 73dab6f

Please # to comment.