Unnamed repository; edit this file 'description' to name the repository.
Merge #11940
11940: minor: bump lsp-server version r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <[email protected]>
bors[bot] 2022-04-09
parent 63acf72 · parent 2d445de · commit 399559e
-rw-r--r--Cargo.lock4
-rw-r--r--crates/rust-analyzer/Cargo.toml2
-rw-r--r--crates/rust-analyzer/src/dispatch.rs6
-rw-r--r--crates/rust-analyzer/src/global_state.rs6
4 files changed, 13 insertions, 5 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 55cf7d638f..aeea1d9efa 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -869,9 +869,9 @@ dependencies = [
[[package]]
name = "lsp-server"
-version = "0.5.2"
+version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c351c75989da23b355226dc188dc2b52538a7f4f218d70fd7393c6b62b110444"
+checksum = "f70570c1c29cf6654029b8fe201a5507c153f0d85be6f234d471d756bc36775a"
dependencies = [
"crossbeam-channel",
"log",
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml
index 87b4203e51..b193c4bae2 100644
--- a/crates/rust-analyzer/Cargo.toml
+++ b/crates/rust-analyzer/Cargo.toml
@@ -33,7 +33,7 @@ threadpool = "1.8.1"
rayon = "1.5.1"
num_cpus = "1.13.1"
mimalloc = { version = "0.1.28", default-features = false, optional = true }
-lsp-server = "0.5.2"
+lsp-server = "0.6.0"
tracing = "0.1.32"
tracing-subscriber = { version = "0.3.9", default-features = false, features = [
"env-filter",
diff --git a/crates/rust-analyzer/src/dispatch.rs b/crates/rust-analyzer/src/dispatch.rs
index 8a7ee7e9c2..9f09af1ff7 100644
--- a/crates/rust-analyzer/src/dispatch.rs
+++ b/crates/rust-analyzer/src/dispatch.rs
@@ -1,6 +1,7 @@
//! See [RequestDispatcher].
use std::{fmt, panic, thread};
+use lsp_server::ExtractError;
use serde::{de::DeserializeOwned, Serialize};
use crate::{
@@ -234,7 +235,10 @@ impl<'a> NotificationDispatcher<'a> {
};
let params = match not.extract::<N::Params>(N::METHOD) {
Ok(it) => it,
- Err(not) => {
+ Err(ExtractError::JsonError { method, error }) => {
+ panic!("Invalid request\nMethod: {method}\n error: {error}",)
+ }
+ Err(ExtractError::MethodMismatch(not)) => {
self.not = Some(not);
return Ok(self);
}
diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs
index 9b4f8b4333..02482d5889 100644
--- a/crates/rust-analyzer/src/global_state.rs
+++ b/crates/rust-analyzer/src/global_state.rs
@@ -256,7 +256,11 @@ impl GlobalState {
self.send(request.into());
}
pub(crate) fn complete_request(&mut self, response: lsp_server::Response) {
- let handler = self.req_queue.outgoing.complete(response.id.clone());
+ let handler = self
+ .req_queue
+ .outgoing
+ .complete(response.id.clone())
+ .expect("received response for unknown request");
handler(self, response)
}