Skip to content

Commit e1a8c0b

Browse files
committed
Auto merge of rust-lang#12687 - flodiebold:override-docs, r=flodiebold
Improve documentation for `buildScripts.overrideCommand` / `checkOnSave.overrideCommand`
2 parents 75b2232 + 5235732 commit e1a8c0b

File tree

3 files changed

+32
-26
lines changed

3 files changed

+32
-26
lines changed

crates/rust-analyzer/src/config.rs

+11-8
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

+11-8
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

+10-10
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,11 @@
375375
"default": {},
376376
"markdownDescription": "Optional settings passed to the debug engine. Example: `{ \"lldb\": { \"terminal\":\"external\"} }`"
377377
},
378+
"rust-analyzer.restartServerOnConfigChange": {
379+
"markdownDescription": "Whether to restart the server automatically when certain settings that require a restart are changed.",
380+
"default": false,
381+
"type": "boolean"
382+
},
378383
"$generated-start": {},
379384
"rust-analyzer.assist.expressionFillDefault": {
380385
"markdownDescription": "Placeholder expression to use for missing expressions in assists.",
@@ -412,7 +417,7 @@
412417
"type": "boolean"
413418
},
414419
"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.",
420+
"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.",
416421
"default": null,
417422
"type": [
418423
"null",
@@ -423,7 +428,7 @@
423428
}
424429
},
425430
"rust-analyzer.cargo.buildScripts.useRustcWrapper": {
426-
"markdownDescription": "Use `RUSTC_WRAPPER=rust-analyzer` when running build scripts to\navoid compiling unnecessary things.",
431+
"markdownDescription": "Use `RUSTC_WRAPPER=rust-analyzer` when running build scripts to\navoid checking unnecessary things.",
427432
"default": true,
428433
"type": "boolean"
429434
},
@@ -500,7 +505,7 @@
500505
}
501506
},
502507
"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.",
508+
"markdownDescription": "List of features to activate. Defaults to\n`#rust-analyzer.cargo.features#`.\n\nSet to `\"all\"` to pass `--all-features` to Cargo.",
504509
"default": null,
505510
"anyOf": [
506511
{
@@ -524,15 +529,15 @@
524529
]
525530
},
526531
"rust-analyzer.checkOnSave.noDefaultFeatures": {
527-
"markdownDescription": "Whether to pass `--no-default-features` to cargo. Defaults to\n`#rust-analyzer.cargo.noDefaultFeatures#`.",
532+
"markdownDescription": "Whether to pass `--no-default-features` to Cargo. Defaults to\n`#rust-analyzer.cargo.noDefaultFeatures#`.",
528533
"default": null,
529534
"type": [
530535
"null",
531536
"boolean"
532537
]
533538
},
534539
"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.",
540+
"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.",
536541
"default": null,
537542
"type": [
538543
"null",
@@ -1116,11 +1121,6 @@
11161121
"Search in current workspace and dependencies."
11171122
]
11181123
},
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-
},
11241124
"$generated-end": {}
11251125
}
11261126
},

0 commit comments

Comments
 (0)