Skip to content

Commit 2b580a1

Browse files
committed
Auto merge of #15492 - RalfJung:invocation, r=Veykril
extend check.overrideCommand and buildScripts.overrideCommand docs Extend check.overrideCommand and buildScripts.overrideCommand docs regarding invocation strategy and location. However something still seems a bit odd -- the docs for `invocationStrategy`/`invocationLocation` talk about "workspaces", but the setting that controls which workspaces are considered is called `linkedProjects`. Is a project the same as a workspace here or is there some subtle difference?
2 parents 8139e8e + ba7f2bf commit 2b580a1

File tree

3 files changed

+24
-8
lines changed

3 files changed

+24
-8
lines changed

crates/rust-analyzer/src/config.rs

+11-3
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,12 @@ config_data! {
9191
/// and should therefore include `--message-format=json` or a similar
9292
/// option.
9393
///
94+
/// If there are multiple linked projects/workspaces, this command is invoked for
95+
/// each of them, with the working directory being the workspace root
96+
/// (i.e., the folder containing the `Cargo.toml`). This can be overwritten
97+
/// by changing `#rust-analyzer.cargo.buildScripts.invocationStrategy#` and
98+
/// `#rust-analyzer.cargo.buildScripts.invocationLocation#`.
99+
///
94100
/// By default, a cargo invocation will be constructed for the configured
95101
/// targets and features, with the following base command line:
96102
///
@@ -182,9 +188,11 @@ config_data! {
182188
/// Cargo, you might also want to change
183189
/// `#rust-analyzer.cargo.buildScripts.overrideCommand#`.
184190
///
185-
/// If there are multiple linked projects, this command is invoked for
186-
/// each of them, with the working directory being the project root
187-
/// (i.e., the folder containing the `Cargo.toml`).
191+
/// If there are multiple linked projects/workspaces, this command is invoked for
192+
/// each of them, with the working directory being the workspace root
193+
/// (i.e., the folder containing the `Cargo.toml`). This can be overwritten
194+
/// by changing `#rust-analyzer.cargo.check.invocationStrategy#` and
195+
/// `#rust-analyzer.cargo.check.invocationLocation#`.
188196
///
189197
/// An example command would be:
190198
///

docs/user/generated_config.adoc

+11-3
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,12 @@ build procedural macros. The command is required to output json
5757
and should therefore include `--message-format=json` or a similar
5858
option.
5959

60+
If there are multiple linked projects/workspaces, this command is invoked for
61+
each of them, with the working directory being the workspace root
62+
(i.e., the folder containing the `Cargo.toml`). This can be overwritten
63+
by changing `#rust-analyzer.cargo.buildScripts.invocationStrategy#` and
64+
`#rust-analyzer.cargo.buildScripts.invocationLocation#`.
65+
6066
By default, a cargo invocation will be constructed for the configured
6167
targets and features, with the following base command line:
6268

@@ -206,9 +212,11 @@ If you're changing this because you're using some tool wrapping
206212
Cargo, you might also want to change
207213
`#rust-analyzer.cargo.buildScripts.overrideCommand#`.
208214

209-
If there are multiple linked projects, this command is invoked for
210-
each of them, with the working directory being the project root
211-
(i.e., the folder containing the `Cargo.toml`).
215+
If there are multiple linked projects/workspaces, this command is invoked for
216+
each of them, with the working directory being the workspace root
217+
(i.e., the folder containing the `Cargo.toml`). This can be overwritten
218+
by changing `#rust-analyzer.cargo.check.invocationStrategy#` and
219+
`#rust-analyzer.cargo.check.invocationLocation#`.
212220

213221
An example command would be:
214222

editors/code/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -557,7 +557,7 @@
557557
]
558558
},
559559
"rust-analyzer.cargo.buildScripts.overrideCommand": {
560-
"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.",
560+
"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#` and\n`#rust-analyzer.cargo.buildScripts.invocationLocation#`.\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.",
561561
"default": null,
562562
"type": [
563563
"null",
@@ -746,7 +746,7 @@
746746
]
747747
},
748748
"rust-analyzer.check.overrideCommand": {
749-
"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, this command is invoked for\neach of them, with the working directory being the project root\n(i.e., the folder containing the `Cargo.toml`).\n\nAn example command would be:\n\n```bash\ncargo check --workspace --message-format=json --all-targets\n```\n.",
749+
"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.cargo.check.invocationStrategy#` and\n`#rust-analyzer.cargo.check.invocationLocation#`.\n\nAn example command would be:\n\n```bash\ncargo check --workspace --message-format=json --all-targets\n```\n.",
750750
"default": null,
751751
"type": [
752752
"null",

0 commit comments

Comments
 (0)