when generating lsp config use RUST_SRC_PATH if set
This commit is contained in:
parent
1ce671528e
commit
b2df015fe6
@ -1,5 +1,6 @@
|
|||||||
use glob::glob;
|
use glob::glob;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
use std::env;
|
||||||
use std::error::Error;
|
use std::error::Error;
|
||||||
use std::process::Command;
|
use std::process::Command;
|
||||||
|
|
||||||
@ -64,6 +65,12 @@ impl RustAnalyzerProject {
|
|||||||
|
|
||||||
/// Use `rustc` to determine the default toolchain
|
/// Use `rustc` to determine the default toolchain
|
||||||
pub fn get_sysroot_src(&mut self) -> Result<(), Box<dyn Error>> {
|
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")
|
let toolchain = Command::new("rustc")
|
||||||
.arg("--print")
|
.arg("--print")
|
||||||
.arg("sysroot")
|
.arg("sysroot")
|
||||||
|
Reference in New Issue
Block a user