diff options
author | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-05-29 13:48:13 +0100 |
---|---|---|
committer | bors[bot] <bors[bot]@users.noreply.github.com> | 2019-05-29 13:48:13 +0100 |
commit | 557a4b8301d33e545fb5bb2b86cc811ecd9de7eb (patch) | |
tree | 130e5984e2a40f467815f9feb49c989beaa7ca97 /crates/ra_lsp_server/src/main_loop/handlers.rs | |
parent | 87c8437af32779e1fd42d94b4c4147f6dd2b8157 (diff) | |
parent | 2c9a1cb3dd941b3f2f608a0633f620478bce0c68 (diff) |
Merge #1342
1342: add latest requests to status page r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_lsp_server/src/main_loop/handlers.rs')
-rw-r--r-- | crates/ra_lsp_server/src/main_loop/handlers.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/crates/ra_lsp_server/src/main_loop/handlers.rs b/crates/ra_lsp_server/src/main_loop/handlers.rs index e36db12b3..dc817f2d9 100644 --- a/crates/ra_lsp_server/src/main_loop/handlers.rs +++ b/crates/ra_lsp_server/src/main_loop/handlers.rs | |||
@@ -1,3 +1,5 @@ | |||
1 | use std::{io::Write as _, fmt::Write as _}; | ||
2 | |||
1 | use gen_lsp_server::ErrorCode; | 3 | use gen_lsp_server::ErrorCode; |
2 | use lsp_types::{ | 4 | use lsp_types::{ |
3 | CodeActionResponse, CodeLens, Command, Diagnostic, DiagnosticSeverity, CodeAction, | 5 | CodeActionResponse, CodeLens, Command, Diagnostic, DiagnosticSeverity, CodeAction, |
@@ -16,7 +18,6 @@ use ra_prof::profile; | |||
16 | use rustc_hash::FxHashMap; | 18 | use rustc_hash::FxHashMap; |
17 | use serde::{Serialize, Deserialize}; | 19 | use serde::{Serialize, Deserialize}; |
18 | use serde_json::to_value; | 20 | use serde_json::to_value; |
19 | use std::io::Write; | ||
20 | use url_serde::Ser; | 21 | use url_serde::Ser; |
21 | 22 | ||
22 | use crate::{ | 23 | use crate::{ |
@@ -28,7 +29,14 @@ use crate::{ | |||
28 | }; | 29 | }; |
29 | 30 | ||
30 | pub fn handle_analyzer_status(world: ServerWorld, _: ()) -> Result<String> { | 31 | pub fn handle_analyzer_status(world: ServerWorld, _: ()) -> Result<String> { |
31 | Ok(world.status()) | 32 | let mut buf = world.status(); |
33 | writeln!(buf, "\n\nrequests:").unwrap(); | ||
34 | let requests = world.latest_completed_requests.read(); | ||
35 | for (idx, r) in requests.iter().enumerate() { | ||
36 | let current = if idx == world.request_idx { "*" } else { " " }; | ||
37 | writeln!(buf, "{:4}{}{:<36}: {:?}", r.id, current, r.method, r.duration).unwrap(); | ||
38 | } | ||
39 | Ok(buf) | ||
32 | } | 40 | } |
33 | 41 | ||
34 | pub fn handle_syntax_tree(world: ServerWorld, params: req::SyntaxTreeParams) -> Result<String> { | 42 | pub fn handle_syntax_tree(world: ServerWorld, params: req::SyntaxTreeParams) -> Result<String> { |