Skip to content

Commit b2df015

Browse files
committed
when generating lsp config use RUST_SRC_PATH if set
1 parent 1ce6715 commit b2df015

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/project.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use glob::glob;
22
use serde::{Deserialize, Serialize};
3+
use std::env;
34
use std::error::Error;
45
use std::process::Command;
56

@@ -64,6 +65,12 @@ impl RustAnalyzerProject {
6465

6566
/// Use `rustc` to determine the default toolchain
6667
pub fn get_sysroot_src(&mut self) -> Result<(), Box<dyn Error>> {
68+
// check if RUST_SRC_PATH is set
69+
if let Ok(path) = env::var("RUST_SRC_PATH") {
70+
self.sysroot_src = path;
71+
return Ok(());
72+
}
73+
6774
let toolchain = Command::new("rustc")
6875
.arg("--print")
6976
.arg("sysroot")

0 commit comments

Comments
 (0)