mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-24 12:03:31 +00:00
Merge #5668
5668: Fix relative path handling for custom rustfmt r=matklad a=matklad
`current_dir` and relative paths to executables works differently on
unix and windows (unix behavior does not make sense), see:
17e30e83a1/src/lib.rs (L295-L324)
The original motivation to set cwd was to make rustfmt read the
correct rustfmt.toml, but that was future proofing, rather than a bug
fix.
So, let's just remove this and see if breaks or fixes more use-cases.
If support for per-file config is needed, we could use `--config-path`
flag.
bors r+
🤖
Co-authored-by: Aleksey Kladov <aleksey.kladov@gmail.com>
This commit is contained in:
commit
2ad29eb231
1 changed files with 0 additions and 5 deletions
|
@ -709,11 +709,6 @@ pub(crate) fn handle_formatting(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Ok(path) = params.text_document.uri.to_file_path() {
|
|
||||||
if let Some(parent) = path.parent() {
|
|
||||||
rustfmt.current_dir(parent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
let mut rustfmt = rustfmt.stdin(Stdio::piped()).stdout(Stdio::piped()).spawn()?;
|
let mut rustfmt = rustfmt.stdin(Stdio::piped()).stdout(Stdio::piped()).spawn()?;
|
||||||
|
|
||||||
rustfmt.stdin.as_mut().unwrap().write_all(file.as_bytes())?;
|
rustfmt.stdin.as_mut().unwrap().write_all(file.as_bytes())?;
|
||||||
|
|
Loading…
Reference in a new issue