How to use the @jupyterlab/codeeditor.IEditorMimeTypeService.defaultMimeType function in @jupyterlab/codeeditor

To help you get started, we’ve selected a few @jupyterlab/codeeditor examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jupyterlab / jupyterlab / packages / codemirror / src / mode.ts View on Github external
export function findBest(mode: string | ISpec): ISpec {
    let modename = typeof mode === 'string' ? mode : mode.mode || mode.name;
    let mimetype = typeof mode !== 'string' ? mode.mime : modename;
    let ext = typeof mode !== 'string' ? mode.ext ?? [] : [];

    return (
      CodeMirror.findModeByName(modename || '') ||
      CodeMirror.findModeByMIME(mimetype || '') ||
      findByExtension(ext) ||
      CodeMirror.findModeByMIME(IEditorMimeTypeService.defaultMimeType) ||
      CodeMirror.findModeByMIME('text/plain')
    );
  }