提交 185f110f 编写于 作者: M Matt Bierner

Use async for findLanguage

上级 4f5491cc
......@@ -603,15 +603,13 @@ class TypeScriptServiceClientHost implements ITypeScriptServiceClientHost {
}
}
private findLanguage(file: string): Thenable<LanguageProvider | null> {
return workspace.openTextDocument(this.client.asUrl(file)).then((doc: TextDocument) => {
for (const language of this.languages) {
if (language.handles(file, doc)) {
return language;
}
}
return null;
}, () => null);
private async findLanguage(file: string): Promise<LanguageProvider | undefined> {
try {
const doc = await workspace.openTextDocument(this.client.asUrl(file));
return this.languages.find(language => language.handles(file, doc));
} catch {
return undefined;
}
}
private triggerAllDiagnostics() {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册