mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Add language_info to setKernelSpec
This commit is contained in:
parent
4f7a2ddf75
commit
426d60625c
|
@ -22,26 +22,7 @@ export function activate(context: vscode.ExtensionContext) {
|
|||
exportNotebook: (notebook: vscode.NotebookData): string => {
|
||||
return exportNotebook(notebook, serializer);
|
||||
},
|
||||
setKernelSpec: async (resource: vscode.Uri, kernelspec: 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
|
||||
},
|
||||
}
|
||||
});
|
||||
return vscode.workspace.applyEdit(edit);
|
||||
},
|
||||
setKernelSpecAndLanguageInfo: async (resource: vscode.Uri, kernelspec: unknown, language_info: unknown): Promise<boolean> => {
|
||||
setKernelSpec: 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;
|
||||
|
@ -55,7 +36,7 @@ export function activate(context: vscode.ExtensionContext) {
|
|||
metadata: {
|
||||
...(document.metadata.custom?.metadata ?? {}),
|
||||
kernelspec: kernelspec,
|
||||
language_info: language_info
|
||||
...(language_info ? { language_info: language_info } : {}),
|
||||
},
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue