Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit ccf854b

Browse files
committed
Improve documentation for buildScripts.overrideCommand / checkOnSave.overrideCommand
1 parent 75b2232 commit ccf854b

File tree

3 files changed

+27
-26
lines changed

3 files changed

+27
-26
lines changed

crates/rust-analyzer/src/config.rs

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ config_data! {
6969
cargo_buildScripts_enable: bool = "true",
7070
/// Override the command rust-analyzer uses to run build scripts and
7171
/// build procedural macros. The command is required to output json
72-
/// and should therefor include `--message-format=json` or a similar
72+
/// and should therefore include `--message-format=json` or a similar
7373
/// option.
7474
///
7575
/// By default, a cargo invocation will be constructed for the configured
@@ -81,7 +81,7 @@ config_data! {
8181
/// .
8282
cargo_buildScripts_overrideCommand: Option<Vec<String>> = "null",
8383
/// Use `RUSTC_WRAPPER=rust-analyzer` when running build scripts to
84-
/// avoid compiling unnecessary things.
84+
/// avoid checking unnecessary things.
8585
cargo_buildScripts_useRustcWrapper: bool = "true",
8686
/// List of features to activate.
8787
///
@@ -107,15 +107,18 @@ config_data! {
107107
/// List of features to activate. Defaults to
108108
/// `#rust-analyzer.cargo.features#`.
109109
///
110-
/// Set to `"all"` to pass `--all-features` to cargo.
110+
/// Set to `"all"` to pass `--all-features` to Cargo.
111111
checkOnSave_features: Option<CargoFeatures> = "null",
112-
/// Whether to pass `--no-default-features` to cargo. Defaults to
112+
/// Whether to pass `--no-default-features` to Cargo. Defaults to
113113
/// `#rust-analyzer.cargo.noDefaultFeatures#`.
114114
checkOnSave_noDefaultFeatures: Option<bool> = "null",
115-
/// Override the command rust-analyzer uses to run build scripts and
116-
/// build procedural macros. The command is required to output json
117-
/// and should therefor include `--message-format=json` or a similar
118-
/// option.
115+
/// Override the command rust-analyzer uses instead of `cargo check` for
116+
/// diagnostics on save. The command is required to output json and
117+
/// should therefor include `--message-format=json` or a similar option.
118+
///
119+
/// If you're changing this because you're using some tool wrapping
120+
/// Cargo, you might also want to change
121+
/// `#rust-analyzer.cargo.buildScripts.overrideCommand#`.
119122
///
120123
/// An example command would be:
121124
///

docs/user/generated_config.adoc

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Run build scripts (`build.rs`) for more precise code analysis.
2929
--
3030
Override the command rust-analyzer uses to run build scripts and
3131
build procedural macros. The command is required to output json
32-
and should therefor include `--message-format=json` or a similar
32+
and should therefore include `--message-format=json` or a similar
3333
option.
3434

3535
By default, a cargo invocation will be constructed for the configured
@@ -44,7 +44,7 @@ cargo check --quiet --workspace --message-format=json --all-targets
4444
+
4545
--
4646
Use `RUSTC_WRAPPER=rust-analyzer` when running build scripts to
47-
avoid compiling unnecessary things.
47+
avoid checking unnecessary things.
4848
--
4949
[[rust-analyzer.cargo.features]]rust-analyzer.cargo.features (default: `[]`)::
5050
+
@@ -99,21 +99,24 @@ Extra arguments for `cargo check`.
9999
List of features to activate. Defaults to
100100
`#rust-analyzer.cargo.features#`.
101101

102-
Set to `"all"` to pass `--all-features` to cargo.
102+
Set to `"all"` to pass `--all-features` to Cargo.
103103
--
104104
[[rust-analyzer.checkOnSave.noDefaultFeatures]]rust-analyzer.checkOnSave.noDefaultFeatures (default: `null`)::
105105
+
106106
--
107-
Whether to pass `--no-default-features` to cargo. Defaults to
107+
Whether to pass `--no-default-features` to Cargo. Defaults to
108108
`#rust-analyzer.cargo.noDefaultFeatures#`.
109109
--
110110
[[rust-analyzer.checkOnSave.overrideCommand]]rust-analyzer.checkOnSave.overrideCommand (default: `null`)::
111111
+
112112
--
113-
Override the command rust-analyzer uses to run build scripts and
114-
build procedural macros. The command is required to output json
115-
and should therefor include `--message-format=json` or a similar
116-
option.
113+
Override the command rust-analyzer uses instead of `cargo check` for
114+
diagnostics on save. The command is required to output json and
115+
should therefor include `--message-format=json` or a similar option.
116+
117+
If you're changing this because you're using some tool wrapping
118+
Cargo, you might also want to change
119+
`#rust-analyzer.cargo.buildScripts.overrideCommand#`.
117120

118121
An example command would be:
119122

editors/code/package.json

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@
412412
"type": "boolean"
413413
},
414414
"rust-analyzer.cargo.buildScripts.overrideCommand": {
415-
"markdownDescription": "Override the command rust-analyzer uses to run build scripts and\nbuild procedural macros. The command is required to output json\nand should therefor include `--message-format=json` or a similar\noption.\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\n```\n.",
415+
"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\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\n```\n.",
416416
"default": null,
417417
"type": [
418418
"null",
@@ -423,7 +423,7 @@
423423
}
424424
},
425425
"rust-analyzer.cargo.buildScripts.useRustcWrapper": {
426-
"markdownDescription": "Use `RUSTC_WRAPPER=rust-analyzer` when running build scripts to\navoid compiling unnecessary things.",
426+
"markdownDescription": "Use `RUSTC_WRAPPER=rust-analyzer` when running build scripts to\navoid checking unnecessary things.",
427427
"default": true,
428428
"type": "boolean"
429429
},
@@ -500,7 +500,7 @@
500500
}
501501
},
502502
"rust-analyzer.checkOnSave.features": {
503-
"markdownDescription": "List of features to activate. Defaults to\n`#rust-analyzer.cargo.features#`.\n\nSet to `\"all\"` to pass `--all-features` to cargo.",
503+
"markdownDescription": "List of features to activate. Defaults to\n`#rust-analyzer.cargo.features#`.\n\nSet to `\"all\"` to pass `--all-features` to Cargo.",
504504
"default": null,
505505
"anyOf": [
506506
{
@@ -524,15 +524,15 @@
524524
]
525525
},
526526
"rust-analyzer.checkOnSave.noDefaultFeatures": {
527-
"markdownDescription": "Whether to pass `--no-default-features` to cargo. Defaults to\n`#rust-analyzer.cargo.noDefaultFeatures#`.",
527+
"markdownDescription": "Whether to pass `--no-default-features` to Cargo. Defaults to\n`#rust-analyzer.cargo.noDefaultFeatures#`.",
528528
"default": null,
529529
"type": [
530530
"null",
531531
"boolean"
532532
]
533533
},
534534
"rust-analyzer.checkOnSave.overrideCommand": {
535-
"markdownDescription": "Override the command rust-analyzer uses to run build scripts and\nbuild procedural macros. The command is required to output json\nand should therefor include `--message-format=json` or a similar\noption.\n\nAn example command would be:\n\n```bash\ncargo check --workspace --message-format=json --all-targets\n```\n.",
535+
"markdownDescription": "Override the command rust-analyzer uses instead of `cargo check` for\ndiagnostics on save. The command is required to output json and\nshould therefor include `--message-format=json` or a similar option.\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\nAn example command would be:\n\n```bash\ncargo check --workspace --message-format=json --all-targets\n```\n.",
536536
"default": null,
537537
"type": [
538538
"null",
@@ -1116,11 +1116,6 @@
11161116
"Search in current workspace and dependencies."
11171117
]
11181118
},
1119-
"rust-analyzer.restartServerOnConfigChange": {
1120-
"markdownDescription": "Whether to restart the server automatically when certain settings that require a restart are changed.",
1121-
"default": false,
1122-
"type": "boolean"
1123-
},
11241119
"$generated-end": {}
11251120
}
11261121
},

0 commit comments

Comments
 (0)