mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-12 05:08:52 +00:00
Merge pull request #18827 from Veykril/push-zqsplmtwsxxk
minor: Honor `CARGO_TARGET_DIR` for cargo target dir config
This commit is contained in:
commit
3d6300330d
1 changed files with 4 additions and 1 deletions
|
@ -2126,7 +2126,10 @@ impl Config {
|
||||||
fn target_dir_from_config(&self, source_root: Option<SourceRootId>) -> Option<Utf8PathBuf> {
|
fn target_dir_from_config(&self, source_root: Option<SourceRootId>) -> Option<Utf8PathBuf> {
|
||||||
self.cargo_targetDir(source_root).as_ref().and_then(|target_dir| match target_dir {
|
self.cargo_targetDir(source_root).as_ref().and_then(|target_dir| match target_dir {
|
||||||
TargetDirectory::UseSubdirectory(true) => {
|
TargetDirectory::UseSubdirectory(true) => {
|
||||||
Some(Utf8PathBuf::from("target/rust-analyzer"))
|
let env_var = env::var("CARGO_TARGET_DIR").ok();
|
||||||
|
let mut path = Utf8PathBuf::from(env_var.as_deref().unwrap_or("target"));
|
||||||
|
path.push("rust-analyzer");
|
||||||
|
Some(path)
|
||||||
}
|
}
|
||||||
TargetDirectory::UseSubdirectory(false) => None,
|
TargetDirectory::UseSubdirectory(false) => None,
|
||||||
TargetDirectory::Directory(dir) => Some(dir.clone()),
|
TargetDirectory::Directory(dir) => Some(dir.clone()),
|
||||||
|
|
Loading…
Reference in a new issue