mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-23 19:43:23 +00:00
Fix relative path handling for custom rustfmt
`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.
This commit is contained in:
parent
af6e9a7eb3
commit
ffe4a5e114
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()?;
|
||||
|
||||
rustfmt.stdin.as_mut().unwrap().write_all(file.as_bytes())?;
|
||||
|
|
Loading…
Reference in a new issue