mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Add setKernelSpecAndLanguageInfo to ipynb ext
This commit is contained in:
parent
9901910447
commit
4f7a2ddf75
|
@ -41,6 +41,26 @@ export function activate(context: vscode.ExtensionContext) {
|
|||
});
|
||||
return vscode.workspace.applyEdit(edit);
|
||||
},
|
||||
setKernelSpecAndLanguageInfo: async (resource: vscode.Uri, kernelspec: unknown, language_info: unknown): Promise<boolean> => {
|
||||
const document = vscode.workspace.notebookDocuments.find(doc => doc.uri.toString() === resource.toString());
|
||||
if (!document) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const edit = new vscode.WorkspaceEdit();
|
||||
edit.replaceNotebookMetadata(resource, {
|
||||
...document.metadata,
|
||||
custom: {
|
||||
...(document.metadata.custom ?? {}),
|
||||
metadata: {
|
||||
...(document.metadata.custom?.metadata ?? {}),
|
||||
kernelspec: kernelspec,
|
||||
language_info: language_info
|
||||
},
|
||||
}
|
||||
});
|
||||
return vscode.workspace.applyEdit(edit);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue