Skip to content

Commit 76b2333

Browse files
committed
Update documentation for overrideCommand config options
1 parent 68e7ec9 commit 76b2333

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed

crates/rust-analyzer/src/config.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,9 @@ config_data! {
726726
/// ```bash
727727
/// cargo check --quiet --workspace --message-format=json --all-targets --keep-going
728728
/// ```
729-
/// .
729+
///
730+
/// Note: The option must be specified as an array of command line arguments, with
731+
/// the first argument being the name of the command to run.
730732
cargo_buildScripts_overrideCommand: Option<Vec<String>> = None,
731733
/// Rerun proc-macros building/build-scripts running when proc-macro
732734
/// or build-script sources change and are saved.
@@ -840,7 +842,9 @@ config_data! {
840842
/// ```bash
841843
/// cargo check --workspace --message-format=json --all-targets
842844
/// ```
843-
/// .
845+
///
846+
/// Note: The option must be specified as an array of command line arguments, with
847+
/// the first argument being the name of the command to run.
844848
check_overrideCommand | checkOnSave_overrideCommand: Option<Vec<String>> = None,
845849
/// Check for specific targets. Defaults to `#rust-analyzer.cargo.target#` if empty.
846850
///
@@ -890,6 +894,9 @@ config_data! {
890894
/// not that of `cargo fmt`. The file contents will be passed on the
891895
/// standard input and the formatted result will be read from the
892896
/// standard output.
897+
///
898+
/// Note: The option must be specified as an array of command line arguments, with
899+
/// the first argument being the name of the command to run.
893900
rustfmt_overrideCommand: Option<Vec<String>> = None,
894901
/// Enables the use of rustfmt's unstable range formatting command for the
895902
/// `textDocument/rangeFormatting` request. The rustfmt option is unstable and only

docs/book/src/configuration_generated.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@ targets and features, with the following base command line:
104104
```bash
105105
cargo check --quiet --workspace --message-format=json --all-targets --keep-going
106106
```
107-
.
107+
108+
Note: The option must be specified as an array of command line arguments, with
109+
the first argument being the name of the command to run.
108110

109111

110112
## rust-analyzer.cargo.buildScripts.rebuildOnSave {#cargo.buildScripts.rebuildOnSave}
@@ -331,7 +333,9 @@ An example command would be:
331333
```bash
332334
cargo check --workspace --message-format=json --all-targets
333335
```
334-
.
336+
337+
Note: The option must be specified as an array of command line arguments, with
338+
the first argument being the name of the command to run.
335339

336340

337341
## rust-analyzer.check.targets {#check.targets}
@@ -1343,6 +1347,9 @@ not that of `cargo fmt`. The file contents will be passed on the
13431347
standard input and the formatted result will be read from the
13441348
standard output.
13451349

1350+
Note: The option must be specified as an array of command line arguments, with
1351+
the first argument being the name of the command to run.
1352+
13461353

13471354
## rust-analyzer.rustfmt.rangeFormatting.enable {#rustfmt.rangeFormatting.enable}
13481355

editors/code/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -887,7 +887,7 @@
887887
"title": "Cargo",
888888
"properties": {
889889
"rust-analyzer.cargo.buildScripts.overrideCommand": {
890-
"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.",
890+
"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.",
891891
"default": null,
892892
"type": [
893893
"null",
@@ -1207,7 +1207,7 @@
12071207
"title": "Check",
12081208
"properties": {
12091209
"rust-analyzer.check.overrideCommand": {
1210-
"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.",
1210+
"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.",
12111211
"default": null,
12121212
"type": [
12131213
"null",
@@ -2808,7 +2808,7 @@
28082808
"title": "Rustfmt",
28092809
"properties": {
28102810
"rust-analyzer.rustfmt.overrideCommand": {
2811-
"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.",
2811+
"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.",
28122812
"default": null,
28132813
"type": [
28142814
"null",

0 commit comments

Comments
 (0)