Skip to content

Commit 291f94e

Browse files
committed
Fix up config docs
1 parent cb6032b commit 291f94e

File tree

5 files changed

+93
-51
lines changed

5 files changed

+93
-51
lines changed

crates/hir-expand/src/builtin_fn_macro.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -641,7 +641,7 @@ fn env_expand(
641641
// unnecessary diagnostics for eg. `CARGO_PKG_NAME`.
642642
if key == "OUT_DIR" {
643643
err = Some(ExpandError::Other(
644-
r#"`OUT_DIR` not set, enable "run build scripts" to fix"#.into(),
644+
r#"`OUT_DIR` not set, enable "build scripts" to fix"#.into(),
645645
));
646646
}
647647

crates/ide-diagnostics/src/handlers/macro_error.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ macro_rules! env { () => {} }
111111
macro_rules! concat { () => {} }
112112
113113
include!(concat!(env!("OUT_DIR"), "/out.rs"));
114-
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `OUT_DIR` not set, enable "run build scripts" to fix
114+
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `OUT_DIR` not set, enable "build scripts" to fix
115115
"#,
116116
);
117117
}
@@ -161,7 +161,7 @@ fn main() {
161161
//^^^^^^^^^^^^^ error: could not convert tokens
162162
163163
env!("OUT_DIR");
164-
//^^^^^^^^^^^^^^^ error: `OUT_DIR` not set, enable "run build scripts" to fix
164+
//^^^^^^^^^^^^^^^ error: `OUT_DIR` not set, enable "build scripts" to fix
165165
166166
compile_error!("compile_error works");
167167
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: compile_error works

crates/rust-analyzer/src/config.rs

Lines changed: 41 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -52,24 +52,35 @@ use crate::{
5252
// parsing the old name.
5353
config_data! {
5454
struct ConfigData {
55-
/// Placeholder for missing expressions in assists.
55+
/// Placeholder expression to use for missing expressions in assists.
5656
assist_expressionFillDefault: ExprFillDefaultDef = "\"todo\"",
5757

5858
/// Automatically refresh project info via `cargo metadata` on
5959
/// `Cargo.toml` changes.
6060
cargo_autoreload: bool = "true",
6161
/// Run build scripts (`build.rs`) for more precise code analysis.
6262
cargo_buildScripts_enable: bool = "true",
63-
/// Advanced option, fully override the command rust-analyzer uses to
64-
/// run build scripts and build procedural macros. The command should
65-
/// include `--message-format=json` or a similar option.
63+
/// Override the command rust-analyzer uses to run build scripts and
64+
/// build procedural macros. The command is required to output json
65+
/// and should therefor include `--message-format=json` or a similar
66+
/// option.
67+
///
68+
/// By default, a cargo invocation will be constructed for the configured
69+
/// targets and features, with the following base command line:
70+
///
71+
/// ```bash
72+
/// cargo check --quiet --workspace --message-format=json --all-targets
73+
/// ```
74+
/// .
6675
cargo_buildScripts_overrideCommand: Option<Vec<String>> = "null",
6776
/// Use `RUSTC_WRAPPER=rust-analyzer` when running build scripts to
6877
/// avoid compiling unnecessary things.
6978
cargo_buildScripts_useRustcWrapper: bool = "true",
70-
/// List of features to activate. Set to `"all"` to pass `--all-features` to cargo.
79+
/// List of features to activate.
80+
///
81+
/// Set this to `"all"` to pass `--all-features` to cargo.
7182
cargo_features: CargoFeatures = "[]",
72-
/// Do not activate the `default` feature.
83+
/// Whether to pass `--no-default-features` to cargo.
7384
cargo_noDefaultFeatures: bool = "false",
7485
/// Internal config for debugging, disables loading of sysroot crates.
7586
cargo_noSysroot: bool = "false",
@@ -87,13 +98,23 @@ config_data! {
8798
/// Extra arguments for `cargo check`.
8899
checkOnSave_extraArgs: Vec<String> = "[]",
89100
/// List of features to activate. Defaults to
90-
/// `#rust-analyzer.cargo.features#`. Set to `"all"` to pass `--all-features` to cargo.
101+
/// `#rust-analyzer.cargo.features#`.
102+
///
103+
/// Set to `"all"` to pass `--all-features` to cargo.
91104
checkOnSave_features: Option<CargoFeatures> = "null",
92105
/// Do not activate the `default` feature.
93106
checkOnSave_noDefaultFeatures: Option<bool> = "null",
94-
/// Advanced option, fully override the command rust-analyzer uses for
95-
/// checking. The command should include `--message-format=json` or
96-
/// similar option.
107+
/// Override the command rust-analyzer uses to run build scripts and
108+
/// build procedural macros. The command is required to output json
109+
/// and should therefor include `--message-format=json` or a similar
110+
/// option.
111+
///
112+
/// An example command would be:
113+
///
114+
/// ```bash
115+
/// cargo check --workspace --message-format=json --all-targets
116+
/// ```
117+
/// .
97118
checkOnSave_overrideCommand: Option<Vec<String>> = "null",
98119
/// Check for a specific target. Defaults to
99120
/// `#rust-analyzer.cargo.target#`.
@@ -183,13 +204,13 @@ config_data! {
183204
/// Controls file watching implementation.
184205
files_watcher: String = "\"client\"",
185206

186-
/// Enables highlighting of related references while hovering your mouse `break`, `loop`, `while`, or `for` keywords.
207+
/// Enables highlighting of related references while the cursor is on `break`, `loop`, `while`, or `for` keywords.
187208
highlightRelated_breakPoints_enable: bool = "true",
188-
/// Enables highlighting of all exit points while hovering your mouse above any `return`, `?`, or return type arrow (`->`).
209+
/// Enables highlighting of all exit points while the cursor is on any `return`, `?`, `fn`, or return type arrow (`->`).
189210
highlightRelated_exitPoints_enable: bool = "true",
190-
/// Enables highlighting of related references while hovering your mouse above any identifier.
211+
/// Enables highlighting of related references while the cursor is on any identifier.
191212
highlightRelated_references_enable: bool = "true",
192-
/// Enables highlighting of all break points for a loop or block context while hovering your mouse above any `async` or `await` keywords.
213+
/// Enables highlighting of all break points for a loop or block context while the cursor is on any `async` or `await` keywords.
193214
highlightRelated_yieldPoints_enable: bool = "true",
194215

195216
/// Whether to show `Debug` action. Only applies when
@@ -233,20 +254,20 @@ config_data! {
233254
/// Whether to show inlay type hints for elided lifetimes in function signatures.
234255
inlayHints_lifetimeElisionHints_enable: LifetimeElisionDef = "\"never\"",
235256
/// Whether to prefer using parameter names as the name for elided lifetime hints if possible.
236-
inlayHints_lifetimeElisionHints_useParameterNames: bool = "false",
257+
inlayHints_lifetimeElisionHints_useParameterNames: bool = "false",
237258
/// Maximum length for inlay hints. Set to null to have an unlimited length.
238-
inlayHints_maxLength: Option<usize> = "25",
259+
inlayHints_maxLength: Option<usize> = "25",
239260
/// Whether to show function parameter name inlay hints at the call
240261
/// site.
241262
inlayHints_parameterHints_enable: bool = "true",
242263
/// Whether to show inlay type hints for compiler inserted reborrows.
243264
inlayHints_reborrowHints_enable: bool = "false",
244265
/// Whether to render trailing colons for parameter hints, and trailing colons for parameter hints.
245-
inlayHints_renderColons: bool = "true",
266+
inlayHints_renderColons: bool = "true",
246267
/// Whether to show inlay type hints for variables.
247268
inlayHints_typeHints_enable: bool = "true",
248-
/// Whether to hide inlay hints for constructors.
249-
inlayHints_typeHints_hideNamedConstructor: bool = "false",
269+
/// Whether to hide inlay type hints for constructors.
270+
inlayHints_typeHints_hideNamedConstructor: bool = "false",
250271

251272
/// Join lines merges consecutive declaration and initialization of an assignment.
252273
joinLines_joinAssignments: bool = "true",
@@ -304,7 +325,7 @@ config_data! {
304325

305326
/// Expand attribute macros. Requires `#rust-analyzer.procMacro.enable#` to be set.
306327
procMacro_attributes_enable: bool = "true",
307-
/// Enable support for procedural macros, implies `#rust-analyzer.cargo.runBuildScripts#`.
328+
/// Enable support for procedural macros, implies `#rust-analyzer.cargo.buildScripts.enable#`.
308329
procMacro_enable: bool = "true",
309330
/// These proc-macros will be ignored when trying to expand them.
310331
///

docs/user/generated_config.adoc

Lines changed: 37 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[[rust-analyzer.assist.expressionFillDefault]]rust-analyzer.assist.expressionFillDefault (default: `"todo"`)::
22
+
33
--
4-
Placeholder for missing expressions in assists.
4+
Placeholder expression to use for missing expressions in assists.
55
--
66
[[rust-analyzer.cargo.autoreload]]rust-analyzer.cargo.autoreload (default: `true`)::
77
+
@@ -17,9 +17,18 @@ Run build scripts (`build.rs`) for more precise code analysis.
1717
[[rust-analyzer.cargo.buildScripts.overrideCommand]]rust-analyzer.cargo.buildScripts.overrideCommand (default: `null`)::
1818
+
1919
--
20-
Advanced option, fully override the command rust-analyzer uses to
21-
run build scripts and build procedural macros. The command should
22-
include `--message-format=json` or a similar option.
20+
Override the command rust-analyzer uses to run build scripts and
21+
build procedural macros. The command is required to output json
22+
and should therefor include `--message-format=json` or a similar
23+
option.
24+
25+
By default, a cargo invocation will be constructed for the configured
26+
targets and features, with the following base command line:
27+
28+
```bash
29+
cargo check --quiet --workspace --message-format=json --all-targets
30+
```
31+
.
2332
--
2433
[[rust-analyzer.cargo.buildScripts.useRustcWrapper]]rust-analyzer.cargo.buildScripts.useRustcWrapper (default: `true`)::
2534
+
@@ -30,12 +39,14 @@ avoid compiling unnecessary things.
3039
[[rust-analyzer.cargo.features]]rust-analyzer.cargo.features (default: `[]`)::
3140
+
3241
--
33-
List of features to activate. Set to `"all"` to pass `--all-features` to cargo.
42+
List of features to activate.
43+
44+
Set this to `"all"` to pass `--all-features` to cargo.
3445
--
3546
[[rust-analyzer.cargo.noDefaultFeatures]]rust-analyzer.cargo.noDefaultFeatures (default: `false`)::
3647
+
3748
--
38-
Do not activate the `default` feature.
49+
Whether to pass `--no-default-features` to cargo.
3950
--
4051
[[rust-analyzer.cargo.noSysroot]]rust-analyzer.cargo.noSysroot (default: `false`)::
4152
+
@@ -76,7 +87,9 @@ Extra arguments for `cargo check`.
7687
+
7788
--
7889
List of features to activate. Defaults to
79-
`#rust-analyzer.cargo.features#`. Set to `"all"` to pass `--all-features` to cargo.
90+
`#rust-analyzer.cargo.features#`.
91+
92+
Set to `"all"` to pass `--all-features` to cargo.
8093
--
8194
[[rust-analyzer.checkOnSave.noDefaultFeatures]]rust-analyzer.checkOnSave.noDefaultFeatures (default: `null`)::
8295
+
@@ -86,9 +99,17 @@ Do not activate the `default` feature.
8699
[[rust-analyzer.checkOnSave.overrideCommand]]rust-analyzer.checkOnSave.overrideCommand (default: `null`)::
87100
+
88101
--
89-
Advanced option, fully override the command rust-analyzer uses for
90-
checking. The command should include `--message-format=json` or
91-
similar option.
102+
Override the command rust-analyzer uses to run build scripts and
103+
build procedural macros. The command is required to output json
104+
and should therefor include `--message-format=json` or a similar
105+
option.
106+
107+
An example command would be:
108+
109+
```bash
110+
cargo check --workspace --message-format=json --all-targets
111+
```
112+
.
92113
--
93114
[[rust-analyzer.checkOnSave.target]]rust-analyzer.checkOnSave.target (default: `null`)::
94115
+
@@ -226,22 +247,22 @@ Controls file watching implementation.
226247
[[rust-analyzer.highlightRelated.breakPoints.enable]]rust-analyzer.highlightRelated.breakPoints.enable (default: `true`)::
227248
+
228249
--
229-
Enables highlighting of related references while hovering your mouse `break`, `loop`, `while`, or `for` keywords.
250+
Enables highlighting of related references while the cursor is on `break`, `loop`, `while`, or `for` keywords.
230251
--
231252
[[rust-analyzer.highlightRelated.exitPoints.enable]]rust-analyzer.highlightRelated.exitPoints.enable (default: `true`)::
232253
+
233254
--
234-
Enables highlighting of all exit points while hovering your mouse above any `return`, `?`, or return type arrow (`->`).
255+
Enables highlighting of all exit points while the cursor is on any `return`, `?`, `fn`, or return type arrow (`->`).
235256
--
236257
[[rust-analyzer.highlightRelated.references.enable]]rust-analyzer.highlightRelated.references.enable (default: `true`)::
237258
+
238259
--
239-
Enables highlighting of related references while hovering your mouse above any identifier.
260+
Enables highlighting of related references while the cursor is on any identifier.
240261
--
241262
[[rust-analyzer.highlightRelated.yieldPoints.enable]]rust-analyzer.highlightRelated.yieldPoints.enable (default: `true`)::
242263
+
243264
--
244-
Enables highlighting of all break points for a loop or block context while hovering your mouse above any `async` or `await` keywords.
265+
Enables highlighting of all break points for a loop or block context while the cursor is on any `async` or `await` keywords.
245266
--
246267
[[rust-analyzer.hover.actions.debug.enable]]rust-analyzer.hover.actions.debug.enable (default: `true`)::
247268
+
@@ -362,7 +383,7 @@ Whether to show inlay type hints for variables.
362383
[[rust-analyzer.inlayHints.typeHints.hideNamedConstructor]]rust-analyzer.inlayHints.typeHints.hideNamedConstructor (default: `false`)::
363384
+
364385
--
365-
Whether to hide inlay hints for constructors.
386+
Whether to hide inlay type hints for constructors.
366387
--
367388
[[rust-analyzer.joinLines.joinAssignments]]rust-analyzer.joinLines.joinAssignments (default: `true`)::
368389
+
@@ -474,7 +495,7 @@ Expand attribute macros. Requires `#rust-analyzer.procMacro.enable#` to be set.
474495
[[rust-analyzer.procMacro.enable]]rust-analyzer.procMacro.enable (default: `true`)::
475496
+
476497
--
477-
Enable support for procedural macros, implies `#rust-analyzer.cargo.runBuildScripts#`.
498+
Enable support for procedural macros, implies `#rust-analyzer.cargo.buildScripts.enable#`.
478499
--
479500
[[rust-analyzer.procMacro.ignored]]rust-analyzer.procMacro.ignored (default: `{}`)::
480501
+

0 commit comments

Comments
 (0)