summaryrefslogtreecommitdiff
path: root/cli/lsp/tsc.rs
diff options
context:
space:
mode:
Diffstat (limited to 'cli/lsp/tsc.rs')
-rw-r--r--cli/lsp/tsc.rs26
1 files changed, 21 insertions, 5 deletions
diff --git a/cli/lsp/tsc.rs b/cli/lsp/tsc.rs
index 66e834bc2..606e47d72 100644
--- a/cli/lsp/tsc.rs
+++ b/cli/lsp/tsc.rs
@@ -1074,18 +1074,25 @@ impl TsServer {
}
let token = token.child_token();
let droppable_token = DroppableToken(token.clone());
- let (tx, rx) = oneshot::channel::<Result<String, AnyError>>();
+ let (tx, mut rx) = oneshot::channel::<Result<String, AnyError>>();
let change = self.pending_change.lock().take();
if self
.sender
- .send((req, snapshot, tx, token, change))
+ .send((req, snapshot, tx, token.clone(), change))
.is_err()
{
return Err(anyhow!("failed to send request to tsc thread"));
}
- let value = rx.await??;
- drop(droppable_token);
- Ok(serde_json::from_str(&value)?)
+ tokio::select! {
+ value = &mut rx => {
+ let value = value??;
+ drop(droppable_token);
+ Ok(serde_json::from_str(&value)?)
+ }
+ _ = token.cancelled() => {
+ Err(anyhow!("request cancelled"))
+ }
+ }
}
}
@@ -4276,6 +4283,15 @@ impl TscRuntime {
"Error during TS request \"{method}\":\n {}",
stack_trace.to_rust_string_lossy(tc_scope),
);
+ } else if let Some(message) = tc_scope.message() {
+ lsp_warn!(
+ "Error during TS request \"{method}\":\n {}\n {}",
+ message.get(tc_scope).to_rust_string_lossy(tc_scope),
+ tc_scope
+ .exception()
+ .map(|exc| exc.to_rust_string_lossy(tc_scope))
+ .unwrap_or_default()
+ );
} else {
lsp_warn!(
"Error during TS request \"{method}\":\n {}",