mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-01 03:03:40 +00:00
Merge #10334
10334: Give rustfmt spawn error context. r=jonas-schievink a=aDotInTheVoid This mean if you misconfigure to ```json { "rust-analyzer.rustfmt.overrideCommand": [ "./nonono" ] } ``` The error message is ``` [Error - 17:54:33] Request textDocument/formatting failed. Message: Failed to spawn "./nonono" Code: -32603 ``` instead of ``` [Error - 17:56:12] Request textDocument/formatting failed. Message: No such file or directory (os error 2) Code: -32603 ``` I'm not sure how to test this, or if it needs a test. Co-authored-by: Nixon Enraght-Moony <nixon.emoony@gmail.com>
This commit is contained in:
commit
8b08666343
@ -7,6 +7,7 @@ use std::{
|
||||
process::{self, Stdio},
|
||||
};
|
||||
|
||||
use anyhow::Context;
|
||||
use ide::{
|
||||
AnnotationConfig, AssistKind, AssistResolveStrategy, FileId, FilePosition, FileRange,
|
||||
HoverAction, HoverGotoTypeData, Query, RangeInfo, Runnable, RunnableKind, SingleResolve,
|
||||
@ -1696,8 +1697,12 @@ fn run_rustfmt(
|
||||
}
|
||||
};
|
||||
|
||||
let mut rustfmt =
|
||||
rustfmt.stdin(Stdio::piped()).stdout(Stdio::piped()).stderr(Stdio::piped()).spawn()?;
|
||||
let mut rustfmt = rustfmt
|
||||
.stdin(Stdio::piped())
|
||||
.stdout(Stdio::piped())
|
||||
.stderr(Stdio::piped())
|
||||
.spawn()
|
||||
.context(format!("Failed to spawn {:?}", rustfmt))?;
|
||||
|
||||
rustfmt.stdin.as_mut().unwrap().write_all(file.as_bytes())?;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user