mirror of
https://github.com/notohh/rustlings.git
synced 2024-12-23 03:38:09 -05:00
when generating lsp config use RUST_SRC_PATH if set
This commit is contained in:
parent
1ce671528e
commit
b2df015fe6
1 changed files with 7 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
|||
use glob::glob;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use std::env;
|
||||
use std::error::Error;
|
||||
use std::process::Command;
|
||||
|
||||
|
@ -64,6 +65,12 @@ impl RustAnalyzerProject {
|
|||
|
||||
/// Use `rustc` to determine the default toolchain
|
||||
pub fn get_sysroot_src(&mut self) -> Result<(), Box<dyn Error>> {
|
||||
// check if RUST_SRC_PATH is set
|
||||
if let Ok(path) = env::var("RUST_SRC_PATH") {
|
||||
self.sysroot_src = path;
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let toolchain = Command::new("rustc")
|
||||
.arg("--print")
|
||||
.arg("sysroot")
|
||||
|
|
Loading…
Reference in a new issue