diff options
| author | Lukas Wirth <me@lukaswirth.dev> | 2025-07-28 14:29:05 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-07-28 14:29:05 +0000 |
| commit | a7c07f66be6af6a195be3de0d315f887e24e8ca6 (patch) | |
| tree | 0a30807884e323eb8794f8434f5a09fcabfe6dac /src/tools/rust-analyzer | |
| parent | d02613573271934e36115b919ab26776fc0fc4a1 (diff) | |
| parent | d51db69e09e00b2283c18f0cdf5415992a396592 (diff) | |
| download | rust-a7c07f66be6af6a195be3de0d315f887e24e8ca6.tar.gz rust-a7c07f66be6af6a195be3de0d315f887e24e8ca6.zip | |
Merge pull request #20327 from Wilfred/saved_file_placeholder
Don't show '$saved_file' literally in IDE status updates
Diffstat (limited to 'src/tools/rust-analyzer')
| -rw-r--r-- | src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs b/src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs index bec57a4bede..512ce0b9de3 100644 --- a/src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs +++ b/src/tools/rust-analyzer/crates/rust-analyzer/src/flycheck.rs @@ -111,7 +111,18 @@ impl fmt::Display for FlycheckConfig { match self { FlycheckConfig::CargoCommand { command, .. } => write!(f, "cargo {command}"), 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(" ")) } } } |
