Fix up config docs

This commit is contained in:
Lukas Wirth 2022-04-29 15:48:48 +02:00
parent cb6032bdf4
commit 291f94e22e
5 changed files with 93 additions and 51 deletions

View file

@ -641,7 +641,7 @@ fn env_expand(
// unnecessary diagnostics for eg. `CARGO_PKG_NAME`. // unnecessary diagnostics for eg. `CARGO_PKG_NAME`.
if key == "OUT_DIR" { if key == "OUT_DIR" {
err = Some(ExpandError::Other( err = Some(ExpandError::Other(
r#"`OUT_DIR` not set, enable "run build scripts" to fix"#.into(), r#"`OUT_DIR` not set, enable "build scripts" to fix"#.into(),
)); ));
} }

View file

@ -111,7 +111,7 @@ macro_rules! env { () => {} }
macro_rules! concat { () => {} } macro_rules! concat { () => {} }
include!(concat!(env!("OUT_DIR"), "/out.rs")); include!(concat!(env!("OUT_DIR"), "/out.rs"));
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `OUT_DIR` not set, enable "run build scripts" to fix //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: `OUT_DIR` not set, enable "build scripts" to fix
"#, "#,
); );
} }
@ -161,7 +161,7 @@ fn main() {
//^^^^^^^^^^^^^ error: could not convert tokens //^^^^^^^^^^^^^ error: could not convert tokens
env!("OUT_DIR"); env!("OUT_DIR");
//^^^^^^^^^^^^^^^ error: `OUT_DIR` not set, enable "run build scripts" to fix //^^^^^^^^^^^^^^^ error: `OUT_DIR` not set, enable "build scripts" to fix
compile_error!("compile_error works"); compile_error!("compile_error works");
//^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: compile_error works //^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ error: compile_error works

View file

@ -52,7 +52,7 @@ use crate::{
// parsing the old name. // parsing the old name.
config_data! { config_data! {
struct ConfigData { struct ConfigData {
/// Placeholder for missing expressions in assists. /// Placeholder expression to use for missing expressions in assists.
assist_expressionFillDefault: ExprFillDefaultDef = "\"todo\"", assist_expressionFillDefault: ExprFillDefaultDef = "\"todo\"",
/// Automatically refresh project info via `cargo metadata` on /// Automatically refresh project info via `cargo metadata` on
@ -60,16 +60,27 @@ config_data! {
cargo_autoreload: bool = "true", cargo_autoreload: bool = "true",
/// Run build scripts (`build.rs`) for more precise code analysis. /// Run build scripts (`build.rs`) for more precise code analysis.
cargo_buildScripts_enable: bool = "true", cargo_buildScripts_enable: bool = "true",
/// Advanced option, fully override the command rust-analyzer uses to /// Override the command rust-analyzer uses to run build scripts and
/// run build scripts and build procedural macros. The command should /// build procedural macros. The command is required to output json
/// include `--message-format=json` or a similar option. /// and should therefor include `--message-format=json` or a similar
/// option.
///
/// By default, a cargo invocation will be constructed for the configured
/// targets and features, with the following base command line:
///
/// ```bash
/// cargo check --quiet --workspace --message-format=json --all-targets
/// ```
/// .
cargo_buildScripts_overrideCommand: Option<Vec<String>> = "null", cargo_buildScripts_overrideCommand: Option<Vec<String>> = "null",
/// Use `RUSTC_WRAPPER=rust-analyzer` when running build scripts to /// Use `RUSTC_WRAPPER=rust-analyzer` when running build scripts to
/// avoid compiling unnecessary things. /// avoid compiling unnecessary things.
cargo_buildScripts_useRustcWrapper: bool = "true", cargo_buildScripts_useRustcWrapper: bool = "true",
/// List of features to activate. Set to `"all"` to pass `--all-features` to cargo. /// List of features to activate.
///
/// Set this to `"all"` to pass `--all-features` to cargo.
cargo_features: CargoFeatures = "[]", cargo_features: CargoFeatures = "[]",
/// Do not activate the `default` feature. /// Whether to pass `--no-default-features` to cargo.
cargo_noDefaultFeatures: bool = "false", cargo_noDefaultFeatures: bool = "false",
/// Internal config for debugging, disables loading of sysroot crates. /// Internal config for debugging, disables loading of sysroot crates.
cargo_noSysroot: bool = "false", cargo_noSysroot: bool = "false",
@ -87,13 +98,23 @@ config_data! {
/// Extra arguments for `cargo check`. /// Extra arguments for `cargo check`.
checkOnSave_extraArgs: Vec<String> = "[]", checkOnSave_extraArgs: Vec<String> = "[]",
/// List of features to activate. Defaults to /// List of features to activate. Defaults to
/// `#rust-analyzer.cargo.features#`. Set to `"all"` to pass `--all-features` to cargo. /// `#rust-analyzer.cargo.features#`.
///
/// Set to `"all"` to pass `--all-features` to cargo.
checkOnSave_features: Option<CargoFeatures> = "null", checkOnSave_features: Option<CargoFeatures> = "null",
/// Do not activate the `default` feature. /// Do not activate the `default` feature.
checkOnSave_noDefaultFeatures: Option<bool> = "null", checkOnSave_noDefaultFeatures: Option<bool> = "null",
/// Advanced option, fully override the command rust-analyzer uses for /// Override the command rust-analyzer uses to run build scripts and
/// checking. The command should include `--message-format=json` or /// build procedural macros. The command is required to output json
/// similar option. /// and should therefor include `--message-format=json` or a similar
/// option.
///
/// An example command would be:
///
/// ```bash
/// cargo check --workspace --message-format=json --all-targets
/// ```
/// .
checkOnSave_overrideCommand: Option<Vec<String>> = "null", checkOnSave_overrideCommand: Option<Vec<String>> = "null",
/// Check for a specific target. Defaults to /// Check for a specific target. Defaults to
/// `#rust-analyzer.cargo.target#`. /// `#rust-analyzer.cargo.target#`.
@ -183,13 +204,13 @@ config_data! {
/// Controls file watching implementation. /// Controls file watching implementation.
files_watcher: String = "\"client\"", files_watcher: String = "\"client\"",
/// Enables highlighting of related references while hovering your mouse `break`, `loop`, `while`, or `for` keywords. /// Enables highlighting of related references while the cursor is on `break`, `loop`, `while`, or `for` keywords.
highlightRelated_breakPoints_enable: bool = "true", highlightRelated_breakPoints_enable: bool = "true",
/// Enables highlighting of all exit points while hovering your mouse above any `return`, `?`, or return type arrow (`->`). /// Enables highlighting of all exit points while the cursor is on any `return`, `?`, `fn`, or return type arrow (`->`).
highlightRelated_exitPoints_enable: bool = "true", highlightRelated_exitPoints_enable: bool = "true",
/// Enables highlighting of related references while hovering your mouse above any identifier. /// Enables highlighting of related references while the cursor is on any identifier.
highlightRelated_references_enable: bool = "true", highlightRelated_references_enable: bool = "true",
/// Enables highlighting of all break points for a loop or block context while hovering your mouse above any `async` or `await` keywords. /// Enables highlighting of all break points for a loop or block context while the cursor is on any `async` or `await` keywords.
highlightRelated_yieldPoints_enable: bool = "true", highlightRelated_yieldPoints_enable: bool = "true",
/// Whether to show `Debug` action. Only applies when /// Whether to show `Debug` action. Only applies when
@ -245,7 +266,7 @@ config_data! {
inlayHints_renderColons: bool = "true", inlayHints_renderColons: bool = "true",
/// Whether to show inlay type hints for variables. /// Whether to show inlay type hints for variables.
inlayHints_typeHints_enable: bool = "true", inlayHints_typeHints_enable: bool = "true",
/// Whether to hide inlay hints for constructors. /// Whether to hide inlay type hints for constructors.
inlayHints_typeHints_hideNamedConstructor: bool = "false", inlayHints_typeHints_hideNamedConstructor: bool = "false",
/// Join lines merges consecutive declaration and initialization of an assignment. /// Join lines merges consecutive declaration and initialization of an assignment.
@ -304,7 +325,7 @@ config_data! {
/// Expand attribute macros. Requires `#rust-analyzer.procMacro.enable#` to be set. /// Expand attribute macros. Requires `#rust-analyzer.procMacro.enable#` to be set.
procMacro_attributes_enable: bool = "true", procMacro_attributes_enable: bool = "true",
/// Enable support for procedural macros, implies `#rust-analyzer.cargo.runBuildScripts#`. /// Enable support for procedural macros, implies `#rust-analyzer.cargo.buildScripts.enable#`.
procMacro_enable: bool = "true", procMacro_enable: bool = "true",
/// These proc-macros will be ignored when trying to expand them. /// These proc-macros will be ignored when trying to expand them.
/// ///

View file

@ -1,7 +1,7 @@
[[rust-analyzer.assist.expressionFillDefault]]rust-analyzer.assist.expressionFillDefault (default: `"todo"`):: [[rust-analyzer.assist.expressionFillDefault]]rust-analyzer.assist.expressionFillDefault (default: `"todo"`)::
+ +
-- --
Placeholder for missing expressions in assists. Placeholder expression to use for missing expressions in assists.
-- --
[[rust-analyzer.cargo.autoreload]]rust-analyzer.cargo.autoreload (default: `true`):: [[rust-analyzer.cargo.autoreload]]rust-analyzer.cargo.autoreload (default: `true`)::
+ +
@ -17,9 +17,18 @@ Run build scripts (`build.rs`) for more precise code analysis.
[[rust-analyzer.cargo.buildScripts.overrideCommand]]rust-analyzer.cargo.buildScripts.overrideCommand (default: `null`):: [[rust-analyzer.cargo.buildScripts.overrideCommand]]rust-analyzer.cargo.buildScripts.overrideCommand (default: `null`)::
+ +
-- --
Advanced option, fully override the command rust-analyzer uses to Override the command rust-analyzer uses to run build scripts and
run build scripts and build procedural macros. The command should build procedural macros. The command is required to output json
include `--message-format=json` or a similar option. and should therefor include `--message-format=json` or a similar
option.
By default, a cargo invocation will be constructed for the configured
targets and features, with the following base command line:
```bash
cargo check --quiet --workspace --message-format=json --all-targets
```
.
-- --
[[rust-analyzer.cargo.buildScripts.useRustcWrapper]]rust-analyzer.cargo.buildScripts.useRustcWrapper (default: `true`):: [[rust-analyzer.cargo.buildScripts.useRustcWrapper]]rust-analyzer.cargo.buildScripts.useRustcWrapper (default: `true`)::
+ +
@ -30,12 +39,14 @@ avoid compiling unnecessary things.
[[rust-analyzer.cargo.features]]rust-analyzer.cargo.features (default: `[]`):: [[rust-analyzer.cargo.features]]rust-analyzer.cargo.features (default: `[]`)::
+ +
-- --
List of features to activate. Set to `"all"` to pass `--all-features` to cargo. List of features to activate.
Set this to `"all"` to pass `--all-features` to cargo.
-- --
[[rust-analyzer.cargo.noDefaultFeatures]]rust-analyzer.cargo.noDefaultFeatures (default: `false`):: [[rust-analyzer.cargo.noDefaultFeatures]]rust-analyzer.cargo.noDefaultFeatures (default: `false`)::
+ +
-- --
Do not activate the `default` feature. Whether to pass `--no-default-features` to cargo.
-- --
[[rust-analyzer.cargo.noSysroot]]rust-analyzer.cargo.noSysroot (default: `false`):: [[rust-analyzer.cargo.noSysroot]]rust-analyzer.cargo.noSysroot (default: `false`)::
+ +
@ -76,7 +87,9 @@ Extra arguments for `cargo check`.
+ +
-- --
List of features to activate. Defaults to List of features to activate. Defaults to
`#rust-analyzer.cargo.features#`. Set to `"all"` to pass `--all-features` to cargo. `#rust-analyzer.cargo.features#`.
Set to `"all"` to pass `--all-features` to cargo.
-- --
[[rust-analyzer.checkOnSave.noDefaultFeatures]]rust-analyzer.checkOnSave.noDefaultFeatures (default: `null`):: [[rust-analyzer.checkOnSave.noDefaultFeatures]]rust-analyzer.checkOnSave.noDefaultFeatures (default: `null`)::
+ +
@ -86,9 +99,17 @@ Do not activate the `default` feature.
[[rust-analyzer.checkOnSave.overrideCommand]]rust-analyzer.checkOnSave.overrideCommand (default: `null`):: [[rust-analyzer.checkOnSave.overrideCommand]]rust-analyzer.checkOnSave.overrideCommand (default: `null`)::
+ +
-- --
Advanced option, fully override the command rust-analyzer uses for Override the command rust-analyzer uses to run build scripts and
checking. The command should include `--message-format=json` or build procedural macros. The command is required to output json
similar option. and should therefor include `--message-format=json` or a similar
option.
An example command would be:
```bash
cargo check --workspace --message-format=json --all-targets
```
.
-- --
[[rust-analyzer.checkOnSave.target]]rust-analyzer.checkOnSave.target (default: `null`):: [[rust-analyzer.checkOnSave.target]]rust-analyzer.checkOnSave.target (default: `null`)::
+ +
@ -226,22 +247,22 @@ Controls file watching implementation.
[[rust-analyzer.highlightRelated.breakPoints.enable]]rust-analyzer.highlightRelated.breakPoints.enable (default: `true`):: [[rust-analyzer.highlightRelated.breakPoints.enable]]rust-analyzer.highlightRelated.breakPoints.enable (default: `true`)::
+ +
-- --
Enables highlighting of related references while hovering your mouse `break`, `loop`, `while`, or `for` keywords. Enables highlighting of related references while the cursor is on `break`, `loop`, `while`, or `for` keywords.
-- --
[[rust-analyzer.highlightRelated.exitPoints.enable]]rust-analyzer.highlightRelated.exitPoints.enable (default: `true`):: [[rust-analyzer.highlightRelated.exitPoints.enable]]rust-analyzer.highlightRelated.exitPoints.enable (default: `true`)::
+ +
-- --
Enables highlighting of all exit points while hovering your mouse above any `return`, `?`, or return type arrow (`->`). Enables highlighting of all exit points while the cursor is on any `return`, `?`, `fn`, or return type arrow (`->`).
-- --
[[rust-analyzer.highlightRelated.references.enable]]rust-analyzer.highlightRelated.references.enable (default: `true`):: [[rust-analyzer.highlightRelated.references.enable]]rust-analyzer.highlightRelated.references.enable (default: `true`)::
+ +
-- --
Enables highlighting of related references while hovering your mouse above any identifier. Enables highlighting of related references while the cursor is on any identifier.
-- --
[[rust-analyzer.highlightRelated.yieldPoints.enable]]rust-analyzer.highlightRelated.yieldPoints.enable (default: `true`):: [[rust-analyzer.highlightRelated.yieldPoints.enable]]rust-analyzer.highlightRelated.yieldPoints.enable (default: `true`)::
+ +
-- --
Enables highlighting of all break points for a loop or block context while hovering your mouse above any `async` or `await` keywords. Enables highlighting of all break points for a loop or block context while the cursor is on any `async` or `await` keywords.
-- --
[[rust-analyzer.hover.actions.debug.enable]]rust-analyzer.hover.actions.debug.enable (default: `true`):: [[rust-analyzer.hover.actions.debug.enable]]rust-analyzer.hover.actions.debug.enable (default: `true`)::
+ +
@ -362,7 +383,7 @@ Whether to show inlay type hints for variables.
[[rust-analyzer.inlayHints.typeHints.hideNamedConstructor]]rust-analyzer.inlayHints.typeHints.hideNamedConstructor (default: `false`):: [[rust-analyzer.inlayHints.typeHints.hideNamedConstructor]]rust-analyzer.inlayHints.typeHints.hideNamedConstructor (default: `false`)::
+ +
-- --
Whether to hide inlay hints for constructors. Whether to hide inlay type hints for constructors.
-- --
[[rust-analyzer.joinLines.joinAssignments]]rust-analyzer.joinLines.joinAssignments (default: `true`):: [[rust-analyzer.joinLines.joinAssignments]]rust-analyzer.joinLines.joinAssignments (default: `true`)::
+ +
@ -474,7 +495,7 @@ Expand attribute macros. Requires `#rust-analyzer.procMacro.enable#` to be set.
[[rust-analyzer.procMacro.enable]]rust-analyzer.procMacro.enable (default: `true`):: [[rust-analyzer.procMacro.enable]]rust-analyzer.procMacro.enable (default: `true`)::
+ +
-- --
Enable support for procedural macros, implies `#rust-analyzer.cargo.runBuildScripts#`. Enable support for procedural macros, implies `#rust-analyzer.cargo.buildScripts.enable#`.
-- --
[[rust-analyzer.procMacro.ignored]]rust-analyzer.procMacro.ignored (default: `{}`):: [[rust-analyzer.procMacro.ignored]]rust-analyzer.procMacro.ignored (default: `{}`)::
+ +

View file

@ -369,7 +369,7 @@
}, },
"$generated-start": {}, "$generated-start": {},
"rust-analyzer.assist.expressionFillDefault": { "rust-analyzer.assist.expressionFillDefault": {
"markdownDescription": "Placeholder for missing expressions in assists.", "markdownDescription": "Placeholder expression to use for missing expressions in assists.",
"default": "todo", "default": "todo",
"type": "string", "type": "string",
"enum": [ "enum": [
@ -392,7 +392,7 @@
"type": "boolean" "type": "boolean"
}, },
"rust-analyzer.cargo.buildScripts.overrideCommand": { "rust-analyzer.cargo.buildScripts.overrideCommand": {
"markdownDescription": "Advanced option, fully override the command rust-analyzer uses to\nrun build scripts and build procedural macros. The command should\ninclude `--message-format=json` or a similar option.", "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.",
"default": null, "default": null,
"type": [ "type": [
"null", "null",
@ -408,7 +408,7 @@
"type": "boolean" "type": "boolean"
}, },
"rust-analyzer.cargo.features": { "rust-analyzer.cargo.features": {
"markdownDescription": "List of features to activate. Set to `\"all\"` to pass `--all-features` to cargo.", "markdownDescription": "List of features to activate.\n\nSet this to `\"all\"` to pass `--all-features` to cargo.",
"default": [], "default": [],
"type": [ "type": [
"string", "string",
@ -425,7 +425,7 @@
] ]
}, },
"rust-analyzer.cargo.noDefaultFeatures": { "rust-analyzer.cargo.noDefaultFeatures": {
"markdownDescription": "Do not activate the `default` feature.", "markdownDescription": "Whether to pass `--no-default-features` to cargo.",
"default": false, "default": false,
"type": "boolean" "type": "boolean"
}, },
@ -476,7 +476,7 @@
} }
}, },
"rust-analyzer.checkOnSave.features": { "rust-analyzer.checkOnSave.features": {
"markdownDescription": "List of features to activate. Defaults to\n`#rust-analyzer.cargo.features#`. Set to `\"all\"` to pass `--all-features` to cargo.", "markdownDescription": "List of features to activate. Defaults to\n`#rust-analyzer.cargo.features#`.\n\nSet to `\"all\"` to pass `--all-features` to cargo.",
"default": null, "default": null,
"type": [ "type": [
"string", "string",
@ -502,7 +502,7 @@
] ]
}, },
"rust-analyzer.checkOnSave.overrideCommand": { "rust-analyzer.checkOnSave.overrideCommand": {
"markdownDescription": "Advanced option, fully override the command rust-analyzer uses for\nchecking. The command should include `--message-format=json` or\nsimilar option.", "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.",
"default": null, "default": null,
"type": [ "type": [
"null", "null",
@ -655,22 +655,22 @@
"type": "string" "type": "string"
}, },
"rust-analyzer.highlightRelated.breakPoints.enable": { "rust-analyzer.highlightRelated.breakPoints.enable": {
"markdownDescription": "Enables highlighting of related references while hovering your mouse `break`, `loop`, `while`, or `for` keywords.", "markdownDescription": "Enables highlighting of related references while the cursor is on `break`, `loop`, `while`, or `for` keywords.",
"default": true, "default": true,
"type": "boolean" "type": "boolean"
}, },
"rust-analyzer.highlightRelated.exitPoints.enable": { "rust-analyzer.highlightRelated.exitPoints.enable": {
"markdownDescription": "Enables highlighting of all exit points while hovering your mouse above any `return`, `?`, or return type arrow (`->`).", "markdownDescription": "Enables highlighting of all exit points while the cursor is on any `return`, `?`, `fn`, or return type arrow (`->`).",
"default": true, "default": true,
"type": "boolean" "type": "boolean"
}, },
"rust-analyzer.highlightRelated.references.enable": { "rust-analyzer.highlightRelated.references.enable": {
"markdownDescription": "Enables highlighting of related references while hovering your mouse above any identifier.", "markdownDescription": "Enables highlighting of related references while the cursor is on any identifier.",
"default": true, "default": true,
"type": "boolean" "type": "boolean"
}, },
"rust-analyzer.highlightRelated.yieldPoints.enable": { "rust-analyzer.highlightRelated.yieldPoints.enable": {
"markdownDescription": "Enables highlighting of all break points for a loop or block context while hovering your mouse above any `async` or `await` keywords.", "markdownDescription": "Enables highlighting of all break points for a loop or block context while the cursor is on any `async` or `await` keywords.",
"default": true, "default": true,
"type": "boolean" "type": "boolean"
}, },
@ -824,7 +824,7 @@
"type": "boolean" "type": "boolean"
}, },
"rust-analyzer.inlayHints.typeHints.hideNamedConstructor": { "rust-analyzer.inlayHints.typeHints.hideNamedConstructor": {
"markdownDescription": "Whether to hide inlay hints for constructors.", "markdownDescription": "Whether to hide inlay type hints for constructors.",
"default": false, "default": false,
"type": "boolean" "type": "boolean"
}, },
@ -936,7 +936,7 @@
"type": "boolean" "type": "boolean"
}, },
"rust-analyzer.procMacro.enable": { "rust-analyzer.procMacro.enable": {
"markdownDescription": "Enable support for procedural macros, implies `#rust-analyzer.cargo.runBuildScripts#`.", "markdownDescription": "Enable support for procedural macros, implies `#rust-analyzer.cargo.buildScripts.enable#`.",
"default": true, "default": true,
"type": "boolean" "type": "boolean"
}, },