aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/rust-analyzer/src/global_state.rs7
-rw-r--r--crates/rust-analyzer/src/main_loop.rs6
2 files changed, 6 insertions, 7 deletions
diff --git a/crates/rust-analyzer/src/global_state.rs b/crates/rust-analyzer/src/global_state.rs
index a8cc71249..a9a1d09fd 100644
--- a/crates/rust-analyzer/src/global_state.rs
+++ b/crates/rust-analyzer/src/global_state.rs
@@ -3,7 +3,7 @@
3//! 3//!
4//! Each tick provides an immutable snapshot of the state as `WorldSnapshot`. 4//! Each tick provides an immutable snapshot of the state as `WorldSnapshot`.
5 5
6use std::sync::Arc; 6use std::{sync::Arc, time::Instant};
7 7
8use crossbeam_channel::{unbounded, Receiver, Sender}; 8use crossbeam_channel::{unbounded, Receiver, Sender};
9use flycheck::FlycheckHandle; 9use flycheck::FlycheckHandle;
@@ -20,7 +20,7 @@ use crate::{
20 diagnostics::{CheckFixes, DiagnosticCollection}, 20 diagnostics::{CheckFixes, DiagnosticCollection},
21 from_proto, 21 from_proto,
22 line_endings::LineEndings, 22 line_endings::LineEndings,
23 main_loop::{ReqQueue, Task}, 23 main_loop::Task,
24 reload::SourceRootConfig, 24 reload::SourceRootConfig,
25 request_metrics::{LatestRequests, RequestMetrics}, 25 request_metrics::{LatestRequests, RequestMetrics},
26 show_message, 26 show_message,
@@ -48,6 +48,9 @@ pub(crate) struct Handle<H, C> {
48 pub(crate) receiver: C, 48 pub(crate) receiver: C,
49} 49}
50 50
51pub(crate) type ReqHandler = fn(&mut GlobalState, lsp_server::Response);
52pub(crate) type ReqQueue = lsp_server::ReqQueue<(String, Instant), ReqHandler>;
53
51/// `GlobalState` is the primary mutable state of the language server 54/// `GlobalState` is the primary mutable state of the language server
52/// 55///
53/// The most interesting components are `vfs`, which stores a consistent 56/// The most interesting components are `vfs`, which stores a consistent
diff --git a/crates/rust-analyzer/src/main_loop.rs b/crates/rust-analyzer/src/main_loop.rs
index d03c68edf..386a47621 100644
--- a/crates/rust-analyzer/src/main_loop.rs
+++ b/crates/rust-analyzer/src/main_loop.rs
@@ -468,10 +468,6 @@ impl GlobalState {
468 } 468 }
469} 469}
470 470
471pub(crate) type ReqHandler = fn(&mut GlobalState, Response);
472pub(crate) type ReqQueue = lsp_server::ReqQueue<(String, Instant), ReqHandler>;
473const DO_NOTHING: ReqHandler = |_, _| ();
474
475#[derive(Eq, PartialEq)] 471#[derive(Eq, PartialEq)]
476enum Progress { 472enum Progress {
477 Begin, 473 Begin,
@@ -499,7 +495,7 @@ fn report_progress(
499 let work_done_progress_create = global_state.req_queue.outgoing.register( 495 let work_done_progress_create = global_state.req_queue.outgoing.register(
500 lsp_types::request::WorkDoneProgressCreate::METHOD.to_string(), 496 lsp_types::request::WorkDoneProgressCreate::METHOD.to_string(),
501 lsp_types::WorkDoneProgressCreateParams { token: token.clone() }, 497 lsp_types::WorkDoneProgressCreateParams { token: token.clone() },
502 DO_NOTHING, 498 |_, _| (),
503 ); 499 );
504 global_state.send(work_done_progress_create.into()); 500 global_state.send(work_done_progress_create.into());
505 501