本文整理汇总了TypeScript中codemirror.findModeByFileName函数的典型用法代码示例。如果您正苦于以下问题:TypeScript findModeByFileName函数的具体用法?TypeScript findModeByFileName怎么用?TypeScript findModeByFileName使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了findModeByFileName函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getMimeTypeByFilePath
/**
* Returns a mime type for the given file path.
*
* #### Notes
* If a mime type cannot be found returns the defaul mime type `text/plain`, never `null`.
*/
getMimeTypeByFilePath(path: string): string {
if (PathExt.extname(path) === '.ipy') {
return 'text/x-python';
}
const mode = CodeMirror.findModeByFileName(path);
return mode ? mode.mime : IEditorMimeTypeService.defaultMimeType;
}
示例2: loadModeByFileName
function loadModeByFileName(editor: CodeMirror.Editor, filename: string): void {
loadInfo(editor, CodeMirror.findModeByFileName(filename));
}
示例3: findByFileName
function findByFileName(name: string): ISpec {
return CodeMirror.findModeByFileName(name);
}
示例4: findByFileName
export function findByFileName(name: string): ISpec {
let basename = PathExt.basename(name);
return CodeMirror.findModeByFileName(basename);
}
示例5: getMimeTypeByFilePath
/**
* Returns a mime type for the given file path.
*
* #### Notes
* If a mime type cannot be found returns the defaul mime type `text/plain`, never `null`.
*/
getMimeTypeByFilePath(path: string): string {
const mode = CodeMirror.findModeByFileName(path);
return mode ? mode.mime : IEditorMimeTypeService.defaultMimeType;
}
示例6: loadModeByFileName
function loadModeByFileName(editor: CodeMirror.Editor, filename: string): Promise<string> {
return loadInfo(editor, CodeMirror.findModeByFileName(filename));
}