type KernelQuickPickItem = IQuickPickItem | InstallExtensionPick | KernelPick | SourcePick; const KERNEL_PICKER_UPDATE_DEBOUNCE = 200; <del> registerAction2(class extends Action2 { constructor() { super({ id: SELECT_KERNEL_ID, category: NOTEBOOK_ACTIONS_CATEGORY, title: { value: localize('notebookActions.selectKernel', "Select Notebook Kernel"), original: 'Select Notebook Kernel' }, // precondition: NOTEBOOK_IS_ACTIVE_EDITOR, icon: selectKernelIcon, f1: true, menu: [{ id: MenuId.EditorTitle, when: ContextKeyExpr.and( NOTEBOOK_IS_ACTIVE_EDITOR, ContextKeyExpr.notEquals('config.notebook.globalToolbar', true) ), group: 'navigation', order: -10 }, { id: MenuId.NotebookToolbar, when: ContextKeyExpr.equals('config.notebook.globalToolbar', true), group: 'status', order: -10 }, { id: MenuId.InteractiveToolbar, when: NOTEBOOK_KERNEL_COUNT.notEqualsTo(0), group: 'status', order: -10 }], description: { description: localize('notebookActions.selectKernel.args', "Notebook Kernel Args"), args: [ { name: 'kernelInfo', description: 'The kernel info', schema: { 'type': 'object', 'required': ['id', 'extension'], 'properties': { 'id': { 'type': 'string' }, 'extension': { 'type': 'string' }, 'notebookEditorId': { 'type': 'string' } } } } ] }, }); } async run(accessor: ServicesAccessor, context?: { id: string; extension: string } | { notebookEditorId: string } | { id: string; extension: string; notebookEditorId: string } | { ui?: boolean; notebookEditor?: NotebookEditorWidget } | undefined ): Promise<boolean> { const notebookKernelService = accessor.get(INotebookKernelService); const editorService = accessor.get(IEditorService); const productService = accessor.get(IProductService); const quickInputService = accessor.get(IQuickInputService); const labelService = accessor.get(ILabelService); const logService = accessor.get(ILogService); const paneCompositeService = accessor.get(IPaneCompositePartService); const extensionWorkbenchService = accessor.get(IExtensionsWorkbenchService); const extensionHostService = accessor.get(IExtensionService); </del> <ins> type KernelQuickPickContext = { id: string; extension: string } | { notebookEditorId: string } | { id: string; extension: string; notebookEditorId: string } | { ui?: boolean; notebookEditor?: NotebookEditorWidget }; interface IKernelPickerStrategy { showQuickPick(context?: KernelQuickPickContext): Promise<boolean>; } </ins> <del> let editor: INotebookEditor | undefined; if (context !== undefined && 'notebookEditorId' in context) { const editorId = context.notebookEditorId; const matchingEditor = editorService.visibleEditorPanes.find((editorPane) => { const notebookEditor = getNotebookEditorFromEditorPane(editorPane); return notebookEditor?.getId() === editorId; }); editor = getNotebookEditorFromEditorPane(matchingEditor); } else if (context !== undefined && 'notebookEditor' in context) { editor = context?.notebookEditor; } else { editor = getNotebookEditorFromEditorPane(editorService.activeEditorPane); } </del> <ins> class KernelPickerFlatStrategy implements IKernelPickerStrategy { constructor( private readonly _notebookKernelService: INotebookKernelService, private readonly _editorService: IEditorService, private readonly _productService: IProductService, private readonly _quickInputService: IQuickInputService, private readonly _labelService: ILabelService, private readonly _logService: ILogService, private readonly _paneCompositePartService: IPaneCompositePartService, private readonly _extensionWorkbenchService: IExtensionsWorkbenchService, private readonly _extensionService: IExtensionService, ) { } async showQuickPick(context?: KernelQuickPickContext): Promise<boolean> { const editor = this._getEditorFromContext(context); </ins> if (!editor || !editor.hasModel()) { return false;