make INotebookKernel2 extends INotebookKernel

This commit is contained in:
Johannes Rieken
2021-04-19 11:56:18 +02:00
parent 6b9bd78998
commit f9fec24b45
6 changed files with 25 additions and 51 deletions

View File

@@ -89,8 +89,13 @@ abstract class MainThreadKernel implements INotebookKernel2 {
this._onDidChange.fire(event);
}
abstract executeNotebookCellsRequest(uri: URI, ranges: ICellRange[]): void;
abstract cancelNotebookCellExecution(uri: URI, ranges: ICellRange[]): void;
abstract executeNotebookCellsRequest(uri: URI, ranges: ICellRange[]): Promise<void>;
abstract cancelNotebookCellExecution(uri: URI, ranges: ICellRange[]): Promise<void>;
// old stuff
readonly resolve = () => Promise.resolve();
get friendlyId() { return this.id; }
get providerHandle() { return undefined; }
}
@extHostNamedCustomer(MainContext.MainThreadNotebookKernels)
@@ -185,11 +190,11 @@ export class MainThreadNotebookKernels implements MainThreadNotebookKernelsShape
async $addKernel(handle: number, data: INotebookKernelDto2): Promise<void> {
const that = this;
const kernel = new class extends MainThreadKernel {
executeNotebookCellsRequest(uri: URI, ranges: ICellRange[]): void {
that._proxy.$executeCells(handle, uri, ranges);
async executeNotebookCellsRequest(uri: URI, ranges: ICellRange[]): Promise<void> {
await that._proxy.$executeCells(handle, uri, ranges);
}
cancelNotebookCellExecution(uri: URI, ranges: ICellRange[]): void {
that._proxy.$cancelCells(handle, uri, ranges);
async cancelNotebookCellExecution(uri: URI, ranges: ICellRange[]): Promise<void> {
await that._proxy.$cancelCells(handle, uri, ranges);
}
}(data);
const registration = this._notebookKernelService.registerKernel(kernel);