aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/main_loop/handlers.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2019-05-29 13:48:13 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2019-05-29 13:48:13 +0100
commit557a4b8301d33e545fb5bb2b86cc811ecd9de7eb (patch)
tree130e5984e2a40f467815f9feb49c989beaa7ca97 /crates/ra_lsp_server/src/main_loop/handlers.rs
parent87c8437af32779e1fd42d94b4c4147f6dd2b8157 (diff)
parent2c9a1cb3dd941b3f2f608a0633f620478bce0c68 (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.rs12
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 @@
1use std::{io::Write as _, fmt::Write as _};
2
1use gen_lsp_server::ErrorCode; 3use gen_lsp_server::ErrorCode;
2use lsp_types::{ 4use lsp_types::{
3 CodeActionResponse, CodeLens, Command, Diagnostic, DiagnosticSeverity, CodeAction, 5 CodeActionResponse, CodeLens, Command, Diagnostic, DiagnosticSeverity, CodeAction,
@@ -16,7 +18,6 @@ use ra_prof::profile;
16use rustc_hash::FxHashMap; 18use rustc_hash::FxHashMap;
17use serde::{Serialize, Deserialize}; 19use serde::{Serialize, Deserialize};
18use serde_json::to_value; 20use serde_json::to_value;
19use std::io::Write;
20use url_serde::Ser; 21use url_serde::Ser;
21 22
22use crate::{ 23use crate::{
@@ -28,7 +29,14 @@ use crate::{
28}; 29};
29 30
30pub fn handle_analyzer_status(world: ServerWorld, _: ()) -> Result<String> { 31pub 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
34pub fn handle_syntax_tree(world: ServerWorld, params: req::SyntaxTreeParams) -> Result<String> { 42pub fn handle_syntax_tree(world: ServerWorld, params: req::SyntaxTreeParams) -> Result<String> {