aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock3
-rw-r--r--crates/hir_ty/Cargo.toml2
-rw-r--r--crates/rust-analyzer/Cargo.toml3
-rw-r--r--crates/rust-analyzer/src/bin/main.rs22
4 files changed, 29 insertions, 1 deletions
diff --git a/Cargo.lock b/Cargo.lock
index efabcf2c5..5c7bcb17b 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1372,6 +1372,9 @@ dependencies = [
1372 "text_edit", 1372 "text_edit",
1373 "threadpool", 1373 "threadpool",
1374 "toolchain", 1374 "toolchain",
1375 "tracing",
1376 "tracing-subscriber",
1377 "tracing-tree",
1375 "tt", 1378 "tt",
1376 "vfs", 1379 "vfs",
1377 "vfs-notify", 1380 "vfs-notify",
diff --git a/crates/hir_ty/Cargo.toml b/crates/hir_ty/Cargo.toml
index be7c812cb..367a1b98d 100644
--- a/crates/hir_ty/Cargo.toml
+++ b/crates/hir_ty/Cargo.toml
@@ -17,7 +17,7 @@ ena = "0.14.0"
17log = "0.4.8" 17log = "0.4.8"
18rustc-hash = "1.1.0" 18rustc-hash = "1.1.0"
19scoped-tls = "1" 19scoped-tls = "1"
20chalk-solve = "0.34" 20chalk-solve = { version = "0.34", default-features = false }
21chalk-ir = "0.34" 21chalk-ir = "0.34"
22chalk-recursive = "0.34" 22chalk-recursive = "0.34"
23 23
diff --git a/crates/rust-analyzer/Cargo.toml b/crates/rust-analyzer/Cargo.toml
index 2f0fa9726..975b24aaf 100644
--- a/crates/rust-analyzer/Cargo.toml
+++ b/crates/rust-analyzer/Cargo.toml
@@ -32,6 +32,9 @@ threadpool = "1.7.1"
32rayon = "1.5" 32rayon = "1.5"
33mimalloc = { version = "0.1.19", default-features = false, optional = true } 33mimalloc = { version = "0.1.19", default-features = false, optional = true }
34lsp-server = "0.4.0" 34lsp-server = "0.4.0"
35tracing = "0.1"
36tracing-subscriber = { version = "0.2", default-features = false, features = ["env-filter", "registry"] }
37tracing-tree = { version = "0.1.4" }
35 38
36stdx = { path = "../stdx", version = "0.0.0" } 39stdx = { path = "../stdx", version = "0.0.0" }
37flycheck = { path = "../flycheck", version = "0.0.0" } 40flycheck = { path = "../flycheck", version = "0.0.0" }
diff --git a/crates/rust-analyzer/src/bin/main.rs b/crates/rust-analyzer/src/bin/main.rs
index 97b246a32..4175e569e 100644
--- a/crates/rust-analyzer/src/bin/main.rs
+++ b/crates/rust-analyzer/src/bin/main.rs
@@ -68,10 +68,32 @@ fn setup_logging(log_file: Option<PathBuf>) -> Result<()> {
68 let filter = env::var("RA_LOG").ok(); 68 let filter = env::var("RA_LOG").ok();
69 logger::Logger::new(log_file, filter.as_deref()).install(); 69 logger::Logger::new(log_file, filter.as_deref()).install();
70 70
71 tracing_setup::setup_tracing()?;
72
71 profile::init(); 73 profile::init();
72 Ok(()) 74 Ok(())
73} 75}
74 76
77mod tracing_setup {
78 use tracing::subscriber;
79 use tracing_subscriber::layer::SubscriberExt;
80 use tracing_subscriber::EnvFilter;
81 use tracing_subscriber::Registry;
82 use tracing_tree::HierarchicalLayer;
83
84 pub fn setup_tracing() -> super::Result<()> {
85 let filter = EnvFilter::from_env("CHALK_DEBUG");
86 let layer = HierarchicalLayer::default()
87 .with_indent_lines(true)
88 .with_ansi(false)
89 .with_indent_amount(2)
90 .with_writer(std::io::stderr);
91 let subscriber = Registry::default().with(filter).with(layer);
92 subscriber::set_global_default(subscriber)?;
93 Ok(())
94 }
95}
96
75fn run_server() -> Result<()> { 97fn run_server() -> Result<()> {
76 log::info!("server will start"); 98 log::info!("server will start");
77 99