Skip to content

Commit

Permalink
lsp: Do not error out on requests returning an empty response
Browse files Browse the repository at this point in the history
It is perfectly valid for Requests to return `()`.
  • Loading branch information
hunger committed Nov 29, 2022
1 parent b48c5a4 commit 01a9309
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions tools/lsp/main.rs
Expand Up @@ -94,13 +94,11 @@ impl ServerNotifier {
Some(OutgoingRequest::Done(d)) => {
if let Some(err) = d.error {
Poll::Ready(Err(err.message.into()))
} else if let Some(d) = d.result {
} else {
Poll::Ready(
serde_json::from_value(d)
serde_json::from_value(d.result.unwrap_or_default())
.map_err(|e| format!("cannot deserialize response: {e:?}").into()),
)
} else {
Poll::Ready(Err("No response".into()))
}
}
}
Expand Down

0 comments on commit 01a9309

Please sign in to comment.