diff --git a/extensions/typescript-language-features/src/features/baseCodeLensProvider.ts b/extensions/typescript-language-features/src/features/baseCodeLensProvider.ts index f48531d6767a6216c5a3f37b397bf41f4170a0ec..18573c0e55e1623a9587b351696fb54cf5b84756 100644 --- a/extensions/typescript-language-features/src/features/baseCodeLensProvider.ts +++ b/extensions/typescript-language-features/src/features/baseCodeLensProvider.ts @@ -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 []; } diff --git a/extensions/typescript-language-features/src/features/documentSymbol.ts b/extensions/typescript-language-features/src/features/documentSymbol.ts index a08ebe0a77353ee127648e44c62ec52378e9d303..787366befd43af00fd96df90bed2772498681944 100644 --- a/extensions/typescript-language-features/src/features/documentSymbol.ts +++ b/extensions/typescript-language-features/src/features/documentSymbol.ts @@ -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; } diff --git a/extensions/typescript-language-features/src/tsServer/cachedResponse.ts b/extensions/typescript-language-features/src/tsServer/cachedResponse.ts index d86856b836617984f54ae68ff453701e265e6acf..6f8f81026264132ae0a43c55e2255201159637ae 100644 --- a/extensions/typescript-language-features/src/tsServer/cachedResponse.ts +++ b/extensions/typescript-language-features/src/tsServer/cachedResponse.ts @@ -12,8 +12,11 @@ export class CachedResponse { private version: number = -1; private document: string = ''; - public execute(document: vscode.TextDocument, f: () => Promise>) { - if (this.matches(document)) { + public execute( + document: vscode.TextDocument, + f: () => Promise> + ): Promise> { + if (this.response && this.matches(document)) { return this.response; } return this.update(document, f());