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.rs19
1 files changed, 7 insertions, 12 deletions
diff --git a/crates/ra_lsp_server/src/main.rs b/crates/ra_lsp_server/src/main.rs
index 82f52a6e8..b0b70df5c 100644
--- a/crates/ra_lsp_server/src/main.rs
+++ b/crates/ra_lsp_server/src/main.rs
@@ -6,21 +6,16 @@ use ra_lsp_server::{Result, InitializationOptions};
6use ra_prof; 6use ra_prof;
7 7
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 let prof_depth = match ::std::env::var("RA_PROFILE_DEPTH") { 15 ra_prof::set_filter(match std::env::var("RA_PROFILE") {
16 Ok(ref d) => d.parse()?, 16 Ok(spec) => ra_prof::Filter::from_spec(&spec),
17 _ => 0, 17 Err(_) => ra_prof::Filter::disabled(),
18 }; 18 });
19 let profile_allowed = match ::std::env::var("RA_PROFILE") {
20 Ok(ref p) => p.split(";").map(String::from).collect(),
21 _ => Vec::new(),
22 };
23 ra_prof::set_filter(ra_prof::Filter::new(prof_depth, profile_allowed));
24 log::info!("lifecycle: server started"); 19 log::info!("lifecycle: server started");
25 match ::std::panic::catch_unwind(main_inner) { 20 match ::std::panic::catch_unwind(main_inner) {
26 Ok(res) => { 21 Ok(res) => {
@@ -36,7 +31,7 @@ fn main() -> Result<()> {
36 31
37fn main_inner() -> Result<()> { 32fn main_inner() -> Result<()> {
38 let (receiver, sender, threads) = stdio_transport(); 33 let (receiver, sender, threads) = stdio_transport();
39 let cwd = ::std::env::current_dir()?; 34 let cwd = std::env::current_dir()?;
40 run_server(ra_lsp_server::server_capabilities(), receiver, sender, |params, r, s| { 35 run_server(ra_lsp_server::server_capabilities(), receiver, sender, |params, r, s| {
41 let root = params.root_uri.and_then(|it| it.to_file_path().ok()).unwrap_or(cwd); 36 let root = params.root_uri.and_then(|it| it.to_file_path().ok()).unwrap_or(cwd);
42 37