aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_lsp_server/src/main.rs')
-rw-r--r--crates/ra_lsp_server/src/main.rs25
1 files changed, 4 insertions, 21 deletions
diff --git a/crates/ra_lsp_server/src/main.rs b/crates/ra_lsp_server/src/main.rs
index 28f9985b6..b0b70df5c 100644
--- a/crates/ra_lsp_server/src/main.rs
+++ b/crates/ra_lsp_server/src/main.rs
@@ -8,31 +8,14 @@ use ra_prof;
8fn main() -> Result<()> { 8fn main() -> Result<()> {
9 std::env::set_var("RUST_BACKTRACE", "short"); 9 std::env::set_var("RUST_BACKTRACE", "short");
10 let logger = Logger::with_env_or_str("error").duplicate_to_stderr(Duplicate::All); 10 let logger = Logger::with_env_or_str("error").duplicate_to_stderr(Duplicate::All);
11 match std::env::var("RA_INTERNAL_MODE") { 11 match std::env::var("RA_LOG_DIR") {
12 Ok(ref v) if v == "1" => logger.log_to_file().directory("log").start()?, 12 Ok(ref v) if v == "1" => logger.log_to_file().directory("log").start()?,
13 _ => logger.start()?, 13 _ => logger.start()?,
14 }; 14 };
15 // Filtering syntax 15 ra_prof::set_filter(match std::env::var("RA_PROFILE") {
16 // env RA_PROFILE=* // dump everything 16 Ok(spec) => ra_prof::Filter::from_spec(&spec),
17 // env RA_PROFILE=foo|bar|baz // enabled only selected entries
18 // env RA_PROFILE=*@3 // dump everything, up to depth 3
19 let filter = match std::env::var("RA_PROFILE") {
20 Ok(p) => {
21 let mut p = p.as_str();
22 let depth = if let Some(idx) = p.rfind("@") {
23 let depth: usize = p[idx + 1..].parse().expect("invalid profile depth");
24 p = &p[..idx];
25 depth
26 } else {
27 999
28 };
29 let allowed =
30 if p == "*" { Vec::new() } else { p.split(";").map(String::from).collect() };
31 ra_prof::Filter::new(depth, allowed)
32 }
33 Err(_) => ra_prof::Filter::disabled(), 17 Err(_) => ra_prof::Filter::disabled(),
34 }; 18 });
35 ra_prof::set_filter(filter);
36 log::info!("lifecycle: server started"); 19 log::info!("lifecycle: server started");
37 match ::std::panic::catch_unwind(main_inner) { 20 match ::std::panic::catch_unwind(main_inner) {
38 Ok(res) => { 21 Ok(res) => {