From 26c8d824d1d58e1588b8bc854814cb4eeccae1e0 Mon Sep 17 00:00:00 2001 From: Kitson Kelly Date: Wed, 7 Apr 2021 19:47:31 +1000 Subject: [PATCH] fix(lsp): don't error on tsc debug failures for code actions (#10047) Resolves: #9913 --- cli/lsp/language_server.rs | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs index 232b528e81..8e8a751a2b 100644 --- a/cli/lsp/language_server.rs +++ b/cli/lsp/language_server.rs @@ -833,12 +833,17 @@ impl Inner { codes, )); let actions: Vec = - self.ts_server.request(self.snapshot(), req).await.map_err( - |err| { + match self.ts_server.request(self.snapshot(), req).await { + Ok(items) => items, + Err(err) => { + // sometimes tsc reports errors when retrieving code actions + // because they don't reflect the current state of the document + // so we will log them to the output, but we won't send an error + // message back to the client. error!("Error getting actions from TypeScript: {}", err); - LspError::internal_error() - }, - )?; + Vec::new() + } + }; for action in actions { code_actions .add_ts_fix_action(&action, diagnostic, self)