mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-31 20:09:01 +00:00
Merge pull request #20327 from Wilfred/saved_file_placeholder
Don't show '$saved_file' literally in IDE status updates
This commit is contained in:
commit
f6d09d365a
1 changed files with 12 additions and 1 deletions
|
|
@ -111,7 +111,18 @@ impl fmt::Display for FlycheckConfig {
|
||||||
match self {
|
match self {
|
||||||
FlycheckConfig::CargoCommand { command, .. } => write!(f, "cargo {command}"),
|
FlycheckConfig::CargoCommand { command, .. } => write!(f, "cargo {command}"),
|
||||||
FlycheckConfig::CustomCommand { command, args, .. } => {
|
FlycheckConfig::CustomCommand { command, args, .. } => {
|
||||||
write!(f, "{command} {}", args.join(" "))
|
// Don't show `my_custom_check --foo $saved_file` literally to the user, as it
|
||||||
|
// looks like we've forgotten to substitute $saved_file.
|
||||||
|
//
|
||||||
|
// Instead, show `my_custom_check --foo ...`. The
|
||||||
|
// actual path is often too long to be worth showing
|
||||||
|
// in the IDE (e.g. in the VS Code status bar).
|
||||||
|
let display_args = args
|
||||||
|
.iter()
|
||||||
|
.map(|arg| if arg == SAVED_FILE_PLACEHOLDER { "..." } else { arg })
|
||||||
|
.collect::<Vec<_>>();
|
||||||
|
|
||||||
|
write!(f, "{command} {}", display_args.join(" "))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue