Merge pull request #20358 from iorizu/issue-20346

minor: Fix documentation for `*.overrideCommand` config options
This commit is contained in:
Chayim Refael Friedman 2025-08-02 18:18:36 +00:00 committed by GitHub
commit e91b6271a8
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 29 additions and 13 deletions

View file

@ -726,7 +726,9 @@ config_data! {
/// ```bash /// ```bash
/// cargo check --quiet --workspace --message-format=json --all-targets --keep-going /// cargo check --quiet --workspace --message-format=json --all-targets --keep-going
/// ``` /// ```
/// . ///
/// Note: The option must be specified as an array of command line arguments, with
/// the first argument being the name of the command to run.
cargo_buildScripts_overrideCommand: Option<Vec<String>> = None, cargo_buildScripts_overrideCommand: Option<Vec<String>> = None,
/// Rerun proc-macros building/build-scripts running when proc-macro /// Rerun proc-macros building/build-scripts running when proc-macro
/// or build-script sources change and are saved. /// or build-script sources change and are saved.
@ -840,7 +842,9 @@ config_data! {
/// ```bash /// ```bash
/// cargo check --workspace --message-format=json --all-targets /// cargo check --workspace --message-format=json --all-targets
/// ``` /// ```
/// . ///
/// Note: The option must be specified as an array of command line arguments, with
/// the first argument being the name of the command to run.
check_overrideCommand | checkOnSave_overrideCommand: Option<Vec<String>> = None, check_overrideCommand | checkOnSave_overrideCommand: Option<Vec<String>> = None,
/// Check for specific targets. Defaults to `#rust-analyzer.cargo.target#` if empty. /// Check for specific targets. Defaults to `#rust-analyzer.cargo.target#` if empty.
/// ///
@ -890,6 +894,9 @@ config_data! {
/// not that of `cargo fmt`. The file contents will be passed on the /// not that of `cargo fmt`. The file contents will be passed on the
/// standard input and the formatted result will be read from the /// standard input and the formatted result will be read from the
/// standard output. /// standard output.
///
/// Note: The option must be specified as an array of command line arguments, with
/// the first argument being the name of the command to run.
rustfmt_overrideCommand: Option<Vec<String>> = None, rustfmt_overrideCommand: Option<Vec<String>> = None,
/// Enables the use of rustfmt's unstable range formatting command for the /// Enables the use of rustfmt's unstable range formatting command for the
/// `textDocument/rangeFormatting` request. The rustfmt option is unstable and only /// `textDocument/rangeFormatting` request. The rustfmt option is unstable and only

View file

@ -104,7 +104,9 @@ targets and features, with the following base command line:
```bash ```bash
cargo check --quiet --workspace --message-format=json --all-targets --keep-going cargo check --quiet --workspace --message-format=json --all-targets --keep-going
``` ```
.
Note: The option must be specified as an array of command line arguments, with
the first argument being the name of the command to run.
## rust-analyzer.cargo.buildScripts.rebuildOnSave {#cargo.buildScripts.rebuildOnSave} ## rust-analyzer.cargo.buildScripts.rebuildOnSave {#cargo.buildScripts.rebuildOnSave}
@ -331,7 +333,9 @@ An example command would be:
```bash ```bash
cargo check --workspace --message-format=json --all-targets cargo check --workspace --message-format=json --all-targets
``` ```
.
Note: The option must be specified as an array of command line arguments, with
the first argument being the name of the command to run.
## rust-analyzer.check.targets {#check.targets} ## rust-analyzer.check.targets {#check.targets}
@ -1343,6 +1347,9 @@ not that of `cargo fmt`. The file contents will be passed on the
standard input and the formatted result will be read from the standard input and the formatted result will be read from the
standard output. standard output.
Note: The option must be specified as an array of command line arguments, with
the first argument being the name of the command to run.
## rust-analyzer.rustfmt.rangeFormatting.enable {#rustfmt.rangeFormatting.enable} ## rust-analyzer.rustfmt.rangeFormatting.enable {#rustfmt.rangeFormatting.enable}

View file

@ -49,8 +49,8 @@ In this case, we'll probably ask you to split API changes into a separate PR.
Changes of the third group should be pretty rare, so we don't specify any specific process for them. Changes of the third group should be pretty rare, so we don't specify any specific process for them.
That said, adding an innocent-looking `pub use` is a very simple way to break encapsulation, keep an eye on it! That said, adding an innocent-looking `pub use` is a very simple way to break encapsulation, keep an eye on it!
Note: if you enjoyed this abstract hand-waving about boundaries, you might appreciate Note: if you enjoyed this abstract hand-waving about boundaries, you might appreciate [this post](https://www.tedinski.com/2018/02/06/system-boundaries.html).
https://www.tedinski.com/2018/02/06/system-boundaries.html
## Crates.io Dependencies ## Crates.io Dependencies
@ -231,7 +231,7 @@ fn is_string_literal(s: &str) -> bool {
} }
``` ```
In the "Not as good" version, the precondition that `1` is a valid char boundary is checked in `is_string_literal` and used in `foo`. In the "Bad" version, the precondition that `1` and `s.len() - 1` are valid string literal boundaries is checked in `is_string_literal` but used in `main`.
In the "Good" version, the precondition check and usage are checked in the same block, and then encoded in the types. In the "Good" version, the precondition check and usage are checked in the same block, and then encoded in the types.
**Rationale:** non-local code properties degrade under change. **Rationale:** non-local code properties degrade under change.
@ -271,6 +271,8 @@ fn f() {
} }
``` ```
See also [this post](https://matklad.github.io/2023/11/15/push-ifs-up-and-fors-down.html)
## Assertions ## Assertions
Assert liberally. Assert liberally.
@ -608,7 +610,7 @@ Avoid making a lot of code type parametric, *especially* on the boundaries betwe
```rust ```rust
// GOOD // GOOD
fn frobnicate(f: impl FnMut()) { fn frobnicate(mut f: impl FnMut()) {
frobnicate_impl(&mut f) frobnicate_impl(&mut f)
} }
fn frobnicate_impl(f: &mut dyn FnMut()) { fn frobnicate_impl(f: &mut dyn FnMut()) {
@ -616,7 +618,7 @@ fn frobnicate_impl(f: &mut dyn FnMut()) {
} }
// BAD // BAD
fn frobnicate(f: impl FnMut()) { fn frobnicate(mut f: impl FnMut()) {
// lots of code // lots of code
} }
``` ```
@ -975,7 +977,7 @@ Don't use the `ref` keyword.
**Rationale:** consistency & simplicity. **Rationale:** consistency & simplicity.
`ref` was required before [match ergonomics](https://github.com/rust-lang/rfcs/blob/master/text/2005-match-ergonomics.md). `ref` was required before [match ergonomics](https://github.com/rust-lang/rfcs/blob/master/text/2005-match-ergonomics.md).
Today, it is redundant. Today, it is redundant.
Between `ref` and mach ergonomics, the latter is more ergonomic in most cases, and is simpler (does not require a keyword). Between `ref` and match ergonomics, the latter is more ergonomic in most cases, and is simpler (does not require a keyword).
## Empty Match Arms ## Empty Match Arms

View file

@ -887,7 +887,7 @@
"title": "Cargo", "title": "Cargo",
"properties": { "properties": {
"rust-analyzer.cargo.buildScripts.overrideCommand": { "rust-analyzer.cargo.buildScripts.overrideCommand": {
"markdownDescription": "Override the command rust-analyzer uses to run build scripts and\nbuild procedural macros. The command is required to output json\nand should therefore include `--message-format=json` or a similar\noption.\n\nIf there are multiple linked projects/workspaces, this command is invoked for\neach of them, with the working directory being the workspace root\n(i.e., the folder containing the `Cargo.toml`). This can be overwritten\nby changing `#rust-analyzer.cargo.buildScripts.invocationStrategy#`.\n\nBy default, a cargo invocation will be constructed for the configured\ntargets and features, with the following base command line:\n\n```bash\ncargo check --quiet --workspace --message-format=json --all-targets --keep-going\n```\n.", "markdownDescription": "Override the command rust-analyzer uses to run build scripts and\nbuild procedural macros. The command is required to output json\nand should therefore include `--message-format=json` or a similar\noption.\n\nIf there are multiple linked projects/workspaces, this command is invoked for\neach of them, with the working directory being the workspace root\n(i.e., the folder containing the `Cargo.toml`). This can be overwritten\nby changing `#rust-analyzer.cargo.buildScripts.invocationStrategy#`.\n\nBy default, a cargo invocation will be constructed for the configured\ntargets and features, with the following base command line:\n\n```bash\ncargo check --quiet --workspace --message-format=json --all-targets --keep-going\n```\n\nNote: The option must be specified as an array of command line arguments, with\nthe first argument being the name of the command to run.",
"default": null, "default": null,
"type": [ "type": [
"null", "null",
@ -1207,7 +1207,7 @@
"title": "Check", "title": "Check",
"properties": { "properties": {
"rust-analyzer.check.overrideCommand": { "rust-analyzer.check.overrideCommand": {
"markdownDescription": "Override the command rust-analyzer uses instead of `cargo check` for\ndiagnostics on save. The command is required to output json and\nshould therefore include `--message-format=json` or a similar option\n(if your client supports the `colorDiagnosticOutput` experimental\ncapability, you can use `--message-format=json-diagnostic-rendered-ansi`).\n\nIf you're changing this because you're using some tool wrapping\nCargo, you might also want to change\n`#rust-analyzer.cargo.buildScripts.overrideCommand#`.\n\nIf there are multiple linked projects/workspaces, this command is invoked for\neach of them, with the working directory being the workspace root\n(i.e., the folder containing the `Cargo.toml`). This can be overwritten\nby changing `#rust-analyzer.check.invocationStrategy#`.\n\nIf `$saved_file` is part of the command, rust-analyzer will pass\nthe absolute path of the saved file to the provided command. This is\nintended to be used with non-Cargo build systems.\nNote that `$saved_file` is experimental and may be removed in the future.\n\nAn example command would be:\n\n```bash\ncargo check --workspace --message-format=json --all-targets\n```\n.", "markdownDescription": "Override the command rust-analyzer uses instead of `cargo check` for\ndiagnostics on save. The command is required to output json and\nshould therefore include `--message-format=json` or a similar option\n(if your client supports the `colorDiagnosticOutput` experimental\ncapability, you can use `--message-format=json-diagnostic-rendered-ansi`).\n\nIf you're changing this because you're using some tool wrapping\nCargo, you might also want to change\n`#rust-analyzer.cargo.buildScripts.overrideCommand#`.\n\nIf there are multiple linked projects/workspaces, this command is invoked for\neach of them, with the working directory being the workspace root\n(i.e., the folder containing the `Cargo.toml`). This can be overwritten\nby changing `#rust-analyzer.check.invocationStrategy#`.\n\nIf `$saved_file` is part of the command, rust-analyzer will pass\nthe absolute path of the saved file to the provided command. This is\nintended to be used with non-Cargo build systems.\nNote that `$saved_file` is experimental and may be removed in the future.\n\nAn example command would be:\n\n```bash\ncargo check --workspace --message-format=json --all-targets\n```\n\nNote: The option must be specified as an array of command line arguments, with\nthe first argument being the name of the command to run.",
"default": null, "default": null,
"type": [ "type": [
"null", "null",
@ -2808,7 +2808,7 @@
"title": "Rustfmt", "title": "Rustfmt",
"properties": { "properties": {
"rust-analyzer.rustfmt.overrideCommand": { "rust-analyzer.rustfmt.overrideCommand": {
"markdownDescription": "Advanced option, fully override the command rust-analyzer uses for\nformatting. This should be the equivalent of `rustfmt` here, and\nnot that of `cargo fmt`. The file contents will be passed on the\nstandard input and the formatted result will be read from the\nstandard output.", "markdownDescription": "Advanced option, fully override the command rust-analyzer uses for\nformatting. This should be the equivalent of `rustfmt` here, and\nnot that of `cargo fmt`. The file contents will be passed on the\nstandard input and the formatted result will be read from the\nstandard output.\n\nNote: The option must be specified as an array of command line arguments, with\nthe first argument being the name of the command to run.",
"default": null, "default": null,
"type": [ "type": [
"null", "null",