import { Kernel, Session } from '@jupyterlab/services'; import { IterableOrArrayLike } from '@phosphor/algorithm'; import { DocumentRegistry } from './registry'; /** * An interface for selecting a new kernel. */ export interface IKernelSelection { /** * The name of the current session. */ name: string; /** * The kernel spec information. */ specs: Kernel.ISpecModels; /** * The current running sessions. */ sessions: IterableOrArrayLike; /** * The desired kernel language. */ preferredLanguage: string; /** * The optional existing kernel model. */ kernel?: Kernel.IModel; /** * The host node for the dialog. */ host?: HTMLElement; } /** * An interface for populating a kernel selector. */ export interface IPopulateOptions { /** * The Kernel specs. */ specs: Kernel.ISpecModels; /** * The current running sessions. */ sessions: IterableOrArrayLike; /** * The optional existing kernel model. */ kernel?: Kernel.IModel; /** * The preferred kernel name. */ preferredKernel?: string; /** * The preferred kernel language. */ preferredLanguage?: string; } /** * Bring up a dialog to select a kernel. */ export declare function selectKernel(options: IKernelSelection): Promise; /** * Change the kernel on a context. */ export declare function selectKernelForContext(context: DocumentRegistry.Context, manager: Session.IManager, host?: HTMLElement): Promise; /** * Get the appropriate kernel name. */ export declare function findKernel(kernelName: string, language: string, specs: Kernel.ISpecModels): string; /** * Populate a kernel dropdown list. * * @param node - The host node. * * @param options - The options used to populate the kernels. * * #### Notes * Populates the list with separated sections: * - Kernels matching the preferred language (display names). * - "None" signifying no kernel. * - The remaining kernels. * - Sessions matching the preferred language (file names). * - The remaining sessions. * If no preferred language is given or no kernels are found using * the preferred language, the default kernel is used in the first * section. Kernels are sorted by display name. Sessions display the * base name of the file with an ellipsis overflow and a tooltip with * the explicit session information. */ export declare function populateKernels(node: HTMLSelectElement, options: IPopulateOptions): void;