From c98966c9f1d3bb220a24d93d93a1623351806513 Mon Sep 17 00:00:00 2001 From: zzgu Date: Mon, 6 Jan 2025 11:28:13 -0800 Subject: [PATCH] revoke codeLnses empty check --- clients/vscode/src/lsp/CodeLensMiddleware.ts | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/clients/vscode/src/lsp/CodeLensMiddleware.ts b/clients/vscode/src/lsp/CodeLensMiddleware.ts index dfddcca13c73..0cbd2874e0b0 100644 --- a/clients/vscode/src/lsp/CodeLensMiddleware.ts +++ b/clients/vscode/src/lsp/CodeLensMiddleware.ts @@ -77,13 +77,11 @@ export class CodeLensMiddleware implements VscodeLspCodeLensMiddleware { } this.removeDecorations(editor); - if (!codeLenses) { - return []; - } - - const result = codeLenses - .map((codeLens) => this.handleCodeLens(codeLens, editor)) - .filter((codeLens): codeLens is CodeLens => codeLens !== null); + + const result = + codeLenses + ?.map((codeLens) => this.handleCodeLens(codeLens, editor)) + .filter((codeLens): codeLens is CodeLens => codeLens !== null) ?? []; this.purgeDecorationMap(); return result; }