diff options
author | Aleksey Kladov <[email protected]> | 2020-06-26 10:21:21 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-06-26 10:21:21 +0100 |
commit | 1272e6cb88f1b2e31e4335b6c499f127f3c6744d (patch) | |
tree | c728005f8c0469fed3f47e97eded4fb54588560c /crates | |
parent | 3f2a596b9bfefdc43621bdafab520dbd814ac959 (diff) |
minor
Diffstat (limited to 'crates')
-rw-r--r-- | crates/rust-analyzer/src/global_state.rs | 7 | ||||
-rw-r--r-- | crates/rust-analyzer/src/main_loop.rs | 6 |
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 | ||
6 | use std::sync::Arc; | 6 | use std::{sync::Arc, time::Instant}; |
7 | 7 | ||
8 | use crossbeam_channel::{unbounded, Receiver, Sender}; | 8 | use crossbeam_channel::{unbounded, Receiver, Sender}; |
9 | use flycheck::FlycheckHandle; | 9 | use 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 | ||
51 | pub(crate) type ReqHandler = fn(&mut GlobalState, lsp_server::Response); | ||
52 | pub(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 | ||
471 | pub(crate) type ReqHandler = fn(&mut GlobalState, Response); | ||
472 | pub(crate) type ReqQueue = lsp_server::ReqQueue<(String, Instant), ReqHandler>; | ||
473 | const DO_NOTHING: ReqHandler = |_, _| (); | ||
474 | |||
475 | #[derive(Eq, PartialEq)] | 471 | #[derive(Eq, PartialEq)] |
476 | enum Progress { | 472 | enum 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 | ||