未验证 提交 1d6bfe08 编写于 作者: C Connor Peet

notebooks: allow marketplace search for arbitrary kernels

上级 bd7a0d4f
......@@ -5,6 +5,7 @@
import { Disposable, DisposableStore, IDisposable, MutableDisposable } from 'vs/base/common/lifecycle';
import { Schemas } from 'vs/base/common/network';
import { uppercaseFirstLetter } from 'vs/base/common/strings';
import { HoverProviderRegistry } from 'vs/editor/common/modes';
import * as nls from 'vs/nls';
import { Action2, MenuId, registerAction2 } from 'vs/platform/actions/common/actions';
......@@ -171,7 +172,7 @@ registerAction2(class extends Action2 {
}
{ return res; }
});
if (!all.length && KERNEL_EXTENSIONS.get(notebook.viewType)) {
if (!all.length) {
picks.push({
id: 'install',
label: nls.localize('installKernels', "Install kernels from the marketplace"),
......@@ -206,11 +207,15 @@ registerAction2(class extends Action2 {
}
private async _showKernelExtension(viewletService: IViewletService, viewType: string) {
const viewlet = await viewletService.openViewlet(EXTENSION_VIEWLET_ID, true);
const view = viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer | undefined;
const extId = KERNEL_EXTENSIONS.get(viewType);
if (extId) {
const viewlet = await viewletService.openViewlet(EXTENSION_VIEWLET_ID, true);
const view = viewlet?.getViewPaneContainer() as IExtensionsViewPaneContainer | undefined;
view?.search(`@id:${extId}`);
} else {
const pascalCased = viewType.split(/[^a-z0-9]/i).map(uppercaseFirstLetter).join('');
view?.search(`@tag:notebookKernel${pascalCased}`);
}
}
});
......
......@@ -87,6 +87,7 @@ export const EXPAND_CELL_OUTPUT_COMMAND_ID = 'notebook.cell.expandCellOutput';
// look them up in the marketplace dynamically.
export const IPYNB_VIEW_TYPE = 'jupyter-notebook';
export const JUPYTER_EXTENSION_ID = 'ms-toolsai.jupyter';
/** @deprecated use the notebookKernel<Type> "keyword" instead */
export const KERNEL_EXTENSIONS = new Map<string, string>([
[IPYNB_VIEW_TYPE, JUPYTER_EXTENSION_ID],
]);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册