UNPKG

@jupyterlab/docregistry

Version:
61 lines 1.94 kB
/* * Copyright (c) Jupyter Development Team. * Distributed under the terms of the Modified BSD License. */ /** * Use available kernels to determine which common file types should have 'Create New' * options in the Launcher, File Editor palette, File menu, FileBrowser etc.. */ export async function getAvailableKernelFileTypes(specsManager) { var _a, _b; const commonLanguageFileTypeData = new Map([ [ 'python', [ { name: 'Python', extensions: ['.py'], icon: 'ui-components:python', displayName: 'Python', mimeTypes: ['text/plain'] } ] ], [ 'julia', [ { name: 'Julia', extensions: ['.jl'], icon: 'ui-components:julia', displayName: 'Julia', mimeTypes: ['text/plain'] } ] ], [ 'R', [ { name: 'R', extensions: ['.r'], icon: 'ui-components:r-kernel', displayName: 'R', mimeTypes: ['text/plain'] } ] ] ]); await specsManager.ready; let fileTypes = new Set(); const specs = (_b = (_a = specsManager.specs) === null || _a === void 0 ? void 0 : _a.kernelspecs) !== null && _b !== void 0 ? _b : {}; Object.keys(specs).forEach(spec => { const specModel = specs[spec]; if (specModel) { const exts = commonLanguageFileTypeData.get(specModel.language); exts === null || exts === void 0 ? void 0 : exts.forEach(ext => fileTypes.add(ext)); } }); return fileTypes; } //# sourceMappingURL=kernelfilestypes.js.map