make preload a creation argument, no editor needed when calling asWebviewUri

上级 fd7cedae
......@@ -1414,7 +1414,6 @@ declare module 'vscode' {
supportedLanguages: string[];
hasExecutionOrder?: boolean;
preloads?: NotebookKernelPreload[];
/**
* The execute handler is invoked when the run gestures in the UI are selected, e.g Run Cell, Run All,
......@@ -1439,9 +1438,10 @@ declare module 'vscode' {
createNotebookCellExecutionTask(cell: NotebookCell): NotebookCellExecutionTask;
// ipc
readonly preloads: NotebookKernelPreload[];
readonly onDidReceiveMessage: Event<{ editor: NotebookEditor, message: any }>;
postMessage(message: any, editor?: NotebookEditor): Thenable<boolean>;
asWebviewUri(localResource: Uri, editor: NotebookEditor): Uri;
asWebviewUri(localResource: Uri): Uri;
}
export interface NotebookControllerOptions {
......@@ -1453,6 +1453,7 @@ declare module 'vscode' {
hasExecutionOrder?: boolean;
executeHandler: (cells: NotebookCell[], controller: NotebookController) => void;
interruptHandler?: (notebook: NotebookDocument) => void
preloads?: NotebookKernelPreload[]
}
export namespace notebook {
......
......@@ -58,6 +58,7 @@ export class ExtHostNotebookKernels implements ExtHostNotebookKernelsShape {
extensionLocation: extension.extensionLocation,
label: options.label,
supportedLanguages: [],
preloads: options.preloads ? options.preloads.map(extHostTypeConverters.NotebookKernelPreload.from) : []
};
//
......@@ -123,11 +124,7 @@ export class ExtHostNotebookKernels implements ExtHostNotebookKernelsShape {
_update();
},
get preloads() {
return data.preloads && data.preloads.map(extHostTypeConverters.NotebookKernelPreload.to);
},
set preloads(value) {
data.preloads = value && value.map(extHostTypeConverters.NotebookKernelPreload.from);
_update();
return data.preloads ? data.preloads.map(extHostTypeConverters.NotebookKernelPreload.to) : [];
},
get executeHandler() {
return _executeHandler;
......@@ -162,8 +159,8 @@ export class ExtHostNotebookKernels implements ExtHostNotebookKernelsShape {
postMessage(message, editor) {
return that._proxy.$postMessage(handle, editor && that._extHostNotebook.getIdByEditor(editor), message);
},
asWebviewUri(uri: URI, editor) {
return asWebviewUri(that._initData.environment, that._extHostNotebook.getIdByEditor(editor)!, uri);
asWebviewUri(uri: URI) {
return asWebviewUri(that._initData.environment, data.id, uri);
}
};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册