mirror of
https://github.com/microsoft/vscode.git
synced 2025-12-23 03:39:23 +00:00
Never return undefined for cachedResponse.execute
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user