提交 7140c912 编写于 作者: M Matt Bierner

Never return undefined for cachedResponse.execute

上级 98605b6a
......@@ -54,7 +54,7 @@ export abstract class TypeScriptBaseCodeLensProvider implements vscode.CodeLensP
}
const response = await this.cachedResponse.execute(document, () => this.client.execute('navtree', { file: filepath }, token));
if (!response || response.type !== 'response') {
if (response.type !== 'response') {
return [];
}
......
......@@ -43,7 +43,7 @@ class TypeScriptDocumentSymbolProvider implements vscode.DocumentSymbolProvider
const args: Proto.FileRequestArgs = { file };
const response = await this.cachedResponse.execute(resource, () => this.client.execute('navtree', args, token));
if (!response || response.type !== 'response' || !response.body) {
if (response.type !== 'response' || !response.body) {
return undefined;
}
......
......@@ -12,8 +12,11 @@ export class CachedResponse<T extends Proto.Response> {
private version: number = -1;
private document: string = '';
public execute(document: vscode.TextDocument, f: () => Promise<ServerResponse<T>>) {
if (this.matches(document)) {
public execute(
document: vscode.TextDocument,
f: () => Promise<ServerResponse<T>>
): Promise<ServerResponse<T>> {
if (this.response && this.matches(document)) {
return this.response;
}
return this.update(document, f());
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册