From 2d445de17026320327f1c037b8b3fcf5704b5aad Mon Sep 17 00:00:00 2001 From: Lukas Wirth Date: Sat, 9 Apr 2022 00:13:47 +0200 Subject: [PATCH] minor: bump lsp-server version --- Cargo.lock | 4 ++-- crates/rust-analyzer/Cargo.toml | 2 +- crates/rust-analyzer/src/dispatch.rs | 6 +++++- crates/rust-analyzer/src/global_state.rs | 6 +++++- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 55cf7d638fd..aeea1d9efa3 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 87b4203e51c..b193c4bae2b 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 8a7ee7e9c23..9f09af1ff7b 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::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 9b4f8b4333a..02482d58893 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) }