summaryrefslogtreecommitdiff
path: root/cli/lsp/language_server.rs
diff options
context:
space:
mode:
authorKitson Kelly <me@kitsonkelly.com>2021-04-07 19:47:31 +1000
committerGitHub <noreply@github.com>2021-04-07 19:47:31 +1000
commit26c8d824d1d58e1588b8bc854814cb4eeccae1e0 (patch)
tree90728315cbca3eccedf24ad5a4d7f2915a803f9b /cli/lsp/language_server.rs
parent704e1e53307130012da974f42d2cad94e07b5664 (diff)
fix(lsp): don't error on tsc debug failures for code actions (#10047)
Resolves: #9913
Diffstat (limited to 'cli/lsp/language_server.rs')
-rw-r--r--cli/lsp/language_server.rs15
1 files changed, 10 insertions, 5 deletions
diff --git a/cli/lsp/language_server.rs b/cli/lsp/language_server.rs
index 232b528e8..8e8a751a2 100644
--- a/cli/lsp/language_server.rs
+++ b/cli/lsp/language_server.rs
@@ -833,12 +833,17 @@ impl Inner {
codes,
));
let actions: Vec<tsc::CodeFixAction> =
- 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)