mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-13 21:54:42 +00:00
Rename checkOnSave settings to check
This commit is contained in:
parent
87d57f51bc
commit
d2bb62b6a8
4 changed files with 274 additions and 281 deletions
|
@ -124,9 +124,67 @@ config_data! {
|
||||||
/// Unsets `#[cfg(test)]` for the specified crates.
|
/// Unsets `#[cfg(test)]` for the specified crates.
|
||||||
cargo_unsetTest: Vec<String> = "[\"core\"]",
|
cargo_unsetTest: Vec<String> = "[\"core\"]",
|
||||||
|
|
||||||
/// Run the flycheck command for diagnostics on save.
|
/// Run the check command for diagnostics on save.
|
||||||
checkOnSave | checkOnSave_enable: bool = "true",
|
checkOnSave | checkOnSave_enable: bool = "true",
|
||||||
|
|
||||||
|
/// Check all targets and tests (`--all-targets`).
|
||||||
|
check_allTargets | checkOnSave_allTargets: bool = "true",
|
||||||
|
/// Cargo command to use for `cargo check`.
|
||||||
|
check_command | checkOnSave_command: String = "\"check\"",
|
||||||
|
/// Extra arguments for `cargo check`.
|
||||||
|
check_extraArgs | checkOnSave_extraArgs: Vec<String> = "[]",
|
||||||
|
/// Extra environment variables that will be set when running `cargo check`.
|
||||||
|
/// Extends `#rust-analyzer.cargo.extraEnv#`.
|
||||||
|
check_extraEnv | checkOnSave_extraEnv: FxHashMap<String, String> = "{}",
|
||||||
|
/// List of features to activate. Defaults to
|
||||||
|
/// `#rust-analyzer.cargo.features#`.
|
||||||
|
///
|
||||||
|
/// Set to `"all"` to pass `--all-features` to Cargo.
|
||||||
|
check_features | checkOnSave_features: Option<CargoFeaturesDef> = "null",
|
||||||
|
/// Specifies the working directory for running checks.
|
||||||
|
/// - "workspace": run checks for workspaces in the corresponding workspaces' root directories.
|
||||||
|
// FIXME: Ideally we would support this in some way
|
||||||
|
/// This falls back to "root" if `#rust-analyzer.cargo.checkOnSave.invocationStrategy#` is set to `once`.
|
||||||
|
/// - "root": run checks in the project's root directory.
|
||||||
|
/// This config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`
|
||||||
|
/// is set.
|
||||||
|
check_invocationLocation | checkOnSave_invocationLocation: InvocationLocation = "\"workspace\"",
|
||||||
|
/// Specifies the invocation strategy to use when running the checkOnSave command.
|
||||||
|
/// If `per_workspace` is set, the command will be executed for each workspace.
|
||||||
|
/// If `once` is set, the command will be executed once.
|
||||||
|
/// This config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`
|
||||||
|
/// is set.
|
||||||
|
check_invocationStrategy | checkOnSave_invocationStrategy: InvocationStrategy = "\"per_workspace\"",
|
||||||
|
/// Whether to pass `--no-default-features` to Cargo. Defaults to
|
||||||
|
/// `#rust-analyzer.cargo.noDefaultFeatures#`.
|
||||||
|
check_noDefaultFeatures | checkOnSave_noDefaultFeatures: Option<bool> = "null",
|
||||||
|
/// Override the command rust-analyzer uses instead of `cargo check` for
|
||||||
|
/// diagnostics on save. The command is required to output json and
|
||||||
|
/// should therefore include `--message-format=json` or a similar option.
|
||||||
|
///
|
||||||
|
/// If you're changing this because you're using some tool wrapping
|
||||||
|
/// Cargo, you might also want to change
|
||||||
|
/// `#rust-analyzer.cargo.buildScripts.overrideCommand#`.
|
||||||
|
///
|
||||||
|
/// If there are multiple linked projects, this command is invoked for
|
||||||
|
/// each of them, with the working directory being the project root
|
||||||
|
/// (i.e., the folder containing the `Cargo.toml`).
|
||||||
|
///
|
||||||
|
/// An example command would be:
|
||||||
|
///
|
||||||
|
/// ```bash
|
||||||
|
/// cargo check --workspace --message-format=json --all-targets
|
||||||
|
/// ```
|
||||||
|
/// .
|
||||||
|
check_overrideCommand | checkOnSave_overrideCommand: Option<Vec<String>> = "null",
|
||||||
|
/// Check for specific targets. Defaults to `#rust-analyzer.cargo.target#` if empty.
|
||||||
|
///
|
||||||
|
/// Can be a single target, e.g. `"x86_64-unknown-linux-gnu"` or a list of targets, e.g.
|
||||||
|
/// `["aarch64-apple-darwin", "x86_64-apple-darwin"]`.
|
||||||
|
///
|
||||||
|
/// Aliased as `"checkOnSave.targets"`.
|
||||||
|
check_targets | checkOnSave_targets | checkOnSave_target: Option<CheckOnSaveTargets> = "null",
|
||||||
|
|
||||||
/// Toggles the additional completions that automatically add imports when completed.
|
/// Toggles the additional completions that automatically add imports when completed.
|
||||||
/// Note that your client must specify the `additionalTextEdits` LSP client capability to truly have this feature enabled.
|
/// Note that your client must specify the `additionalTextEdits` LSP client capability to truly have this feature enabled.
|
||||||
completion_autoimport_enable: bool = "true",
|
completion_autoimport_enable: bool = "true",
|
||||||
|
@ -211,64 +269,6 @@ config_data! {
|
||||||
/// Controls file watching implementation.
|
/// Controls file watching implementation.
|
||||||
files_watcher: FilesWatcherDef = "\"client\"",
|
files_watcher: FilesWatcherDef = "\"client\"",
|
||||||
|
|
||||||
/// Check all targets and tests (`--all-targets`).
|
|
||||||
flycheck_allTargets | checkOnSave_allTargets: bool = "true",
|
|
||||||
/// Cargo command to use for `cargo check`.
|
|
||||||
flycheck_command | checkOnSave_command: String = "\"check\"",
|
|
||||||
/// Extra arguments for `cargo check`.
|
|
||||||
flycheck_extraArgs | checkOnSave_extraArgs: Vec<String> = "[]",
|
|
||||||
/// Extra environment variables that will be set when running `cargo check`.
|
|
||||||
/// Extends `#rust-analyzer.cargo.extraEnv#`.
|
|
||||||
flycheck_extraEnv | checkOnSave_extraEnv: FxHashMap<String, String> = "{}",
|
|
||||||
/// List of features to activate. Defaults to
|
|
||||||
/// `#rust-analyzer.cargo.features#`.
|
|
||||||
///
|
|
||||||
/// Set to `"all"` to pass `--all-features` to Cargo.
|
|
||||||
flycheck_features | checkOnSave_features: Option<CargoFeaturesDef> = "null",
|
|
||||||
/// Specifies the working directory for running checks.
|
|
||||||
/// - "workspace": run checks for workspaces in the corresponding workspaces' root directories.
|
|
||||||
// FIXME: Ideally we would support this in some way
|
|
||||||
/// This falls back to "root" if `#rust-analyzer.cargo.checkOnSave.invocationStrategy#` is set to `once`.
|
|
||||||
/// - "root": run checks in the project's root directory.
|
|
||||||
/// This config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`
|
|
||||||
/// is set.
|
|
||||||
flycheck_invocationLocation | checkOnSave_invocationLocation: InvocationLocation = "\"workspace\"",
|
|
||||||
/// Specifies the invocation strategy to use when running the checkOnSave command.
|
|
||||||
/// If `per_workspace` is set, the command will be executed for each workspace.
|
|
||||||
/// If `once` is set, the command will be executed once.
|
|
||||||
/// This config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`
|
|
||||||
/// is set.
|
|
||||||
flycheck_invocationStrategy | checkOnSave_invocationStrategy: InvocationStrategy = "\"per_workspace\"",
|
|
||||||
/// Whether to pass `--no-default-features` to Cargo. Defaults to
|
|
||||||
/// `#rust-analyzer.cargo.noDefaultFeatures#`.
|
|
||||||
flycheck_noDefaultFeatures | checkOnSave_noDefaultFeatures: Option<bool> = "null",
|
|
||||||
/// Override the command rust-analyzer uses instead of `cargo check` for
|
|
||||||
/// diagnostics on save. The command is required to output json and
|
|
||||||
/// should therefore include `--message-format=json` or a similar option.
|
|
||||||
///
|
|
||||||
/// If you're changing this because you're using some tool wrapping
|
|
||||||
/// Cargo, you might also want to change
|
|
||||||
/// `#rust-analyzer.cargo.buildScripts.overrideCommand#`.
|
|
||||||
///
|
|
||||||
/// If there are multiple linked projects, this command is invoked for
|
|
||||||
/// each of them, with the working directory being the project root
|
|
||||||
/// (i.e., the folder containing the `Cargo.toml`).
|
|
||||||
///
|
|
||||||
/// An example command would be:
|
|
||||||
///
|
|
||||||
/// ```bash
|
|
||||||
/// cargo check --workspace --message-format=json --all-targets
|
|
||||||
/// ```
|
|
||||||
/// .
|
|
||||||
flycheck_overrideCommand | checkOnSave_overrideCommand: Option<Vec<String>> = "null",
|
|
||||||
/// Check for specific targets. Defaults to `#rust-analyzer.cargo.target#` if empty.
|
|
||||||
///
|
|
||||||
/// Can be a single target, e.g. `"x86_64-unknown-linux-gnu"` or a list of targets, e.g.
|
|
||||||
/// `["aarch64-apple-darwin", "x86_64-apple-darwin"]`.
|
|
||||||
///
|
|
||||||
/// Aliased as `"checkOnSave.targets"`.
|
|
||||||
flycheck_targets | checkOnSave_targets | checkOnSave_target: Option<CheckOnSaveTargets> = "null",
|
|
||||||
|
|
||||||
/// Enables highlighting of related references while the cursor is on `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 the cursor is on any `return`, `?`, `fn`, or return type arrow (`->`).
|
/// Enables highlighting of all exit points while the cursor is on any `return`, `?`, `fn`, or return type arrow (`->`).
|
||||||
|
@ -787,9 +787,9 @@ impl Config {
|
||||||
|
|
||||||
fn validate(&self, error_sink: &mut Vec<(String, serde_json::Error)>) {
|
fn validate(&self, error_sink: &mut Vec<(String, serde_json::Error)>) {
|
||||||
use serde::de::Error;
|
use serde::de::Error;
|
||||||
if self.data.flycheck_command.is_empty() {
|
if self.data.check_command.is_empty() {
|
||||||
error_sink.push((
|
error_sink.push((
|
||||||
"/flycheck/command".to_string(),
|
"/check/command".to_string(),
|
||||||
serde_json::Error::custom("expected a non-empty string"),
|
serde_json::Error::custom("expected a non-empty string"),
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
@ -1034,7 +1034,7 @@ impl Config {
|
||||||
|
|
||||||
pub fn check_on_save_extra_env(&self) -> FxHashMap<String, String> {
|
pub fn check_on_save_extra_env(&self) -> FxHashMap<String, String> {
|
||||||
let mut extra_env = self.data.cargo_extraEnv.clone();
|
let mut extra_env = self.data.cargo_extraEnv.clone();
|
||||||
extra_env.extend(self.data.flycheck_extraEnv.clone());
|
extra_env.extend(self.data.check_extraEnv.clone());
|
||||||
extra_env
|
extra_env
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1146,7 +1146,7 @@ impl Config {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn flycheck(&self) -> FlycheckConfig {
|
pub fn flycheck(&self) -> FlycheckConfig {
|
||||||
match &self.data.flycheck_overrideCommand {
|
match &self.data.check_overrideCommand {
|
||||||
Some(args) if !args.is_empty() => {
|
Some(args) if !args.is_empty() => {
|
||||||
let mut args = args.clone();
|
let mut args = args.clone();
|
||||||
let command = args.remove(0);
|
let command = args.remove(0);
|
||||||
|
@ -1154,13 +1154,13 @@ impl Config {
|
||||||
command,
|
command,
|
||||||
args,
|
args,
|
||||||
extra_env: self.check_on_save_extra_env(),
|
extra_env: self.check_on_save_extra_env(),
|
||||||
invocation_strategy: match self.data.flycheck_invocationStrategy {
|
invocation_strategy: match self.data.check_invocationStrategy {
|
||||||
InvocationStrategy::Once => flycheck::InvocationStrategy::Once,
|
InvocationStrategy::Once => flycheck::InvocationStrategy::Once,
|
||||||
InvocationStrategy::PerWorkspace => {
|
InvocationStrategy::PerWorkspace => {
|
||||||
flycheck::InvocationStrategy::PerWorkspace
|
flycheck::InvocationStrategy::PerWorkspace
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
invocation_location: match self.data.flycheck_invocationLocation {
|
invocation_location: match self.data.check_invocationLocation {
|
||||||
InvocationLocation::Root => {
|
InvocationLocation::Root => {
|
||||||
flycheck::InvocationLocation::Root(self.root_path.clone())
|
flycheck::InvocationLocation::Root(self.root_path.clone())
|
||||||
}
|
}
|
||||||
|
@ -1169,35 +1169,35 @@ impl Config {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Some(_) | None => FlycheckConfig::CargoCommand {
|
Some(_) | None => FlycheckConfig::CargoCommand {
|
||||||
command: self.data.flycheck_command.clone(),
|
command: self.data.check_command.clone(),
|
||||||
target_triples: self
|
target_triples: self
|
||||||
.data
|
.data
|
||||||
.flycheck_targets
|
.check_targets
|
||||||
.clone()
|
.clone()
|
||||||
.and_then(|targets| match &targets.0[..] {
|
.and_then(|targets| match &targets.0[..] {
|
||||||
[] => None,
|
[] => None,
|
||||||
targets => Some(targets.into()),
|
targets => Some(targets.into()),
|
||||||
})
|
})
|
||||||
.unwrap_or_else(|| self.data.cargo_target.clone().into_iter().collect()),
|
.unwrap_or_else(|| self.data.cargo_target.clone().into_iter().collect()),
|
||||||
all_targets: self.data.flycheck_allTargets,
|
all_targets: self.data.check_allTargets,
|
||||||
no_default_features: self
|
no_default_features: self
|
||||||
.data
|
.data
|
||||||
.flycheck_noDefaultFeatures
|
.check_noDefaultFeatures
|
||||||
.unwrap_or(self.data.cargo_noDefaultFeatures),
|
.unwrap_or(self.data.cargo_noDefaultFeatures),
|
||||||
all_features: matches!(
|
all_features: matches!(
|
||||||
self.data.flycheck_features.as_ref().unwrap_or(&self.data.cargo_features),
|
self.data.check_features.as_ref().unwrap_or(&self.data.cargo_features),
|
||||||
CargoFeaturesDef::All
|
CargoFeaturesDef::All
|
||||||
),
|
),
|
||||||
features: match self
|
features: match self
|
||||||
.data
|
.data
|
||||||
.flycheck_features
|
.check_features
|
||||||
.clone()
|
.clone()
|
||||||
.unwrap_or_else(|| self.data.cargo_features.clone())
|
.unwrap_or_else(|| self.data.cargo_features.clone())
|
||||||
{
|
{
|
||||||
CargoFeaturesDef::All => vec![],
|
CargoFeaturesDef::All => vec![],
|
||||||
CargoFeaturesDef::Selected(it) => it,
|
CargoFeaturesDef::Selected(it) => it,
|
||||||
},
|
},
|
||||||
extra_args: self.data.flycheck_extraArgs.clone(),
|
extra_args: self.data.check_extraArgs.clone(),
|
||||||
extra_env: self.check_on_save_extra_env(),
|
extra_env: self.check_on_save_extra_env(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -1887,13 +1887,6 @@ fn get_field<T: DeserializeOwned>(
|
||||||
}
|
}
|
||||||
|
|
||||||
fn schema(fields: &[(&'static str, &'static str, &[&str], &str)]) -> serde_json::Value {
|
fn schema(fields: &[(&'static str, &'static str, &[&str], &str)]) -> serde_json::Value {
|
||||||
for ((f1, ..), (f2, ..)) in fields.iter().zip(&fields[1..]) {
|
|
||||||
fn key(f: &str) -> &str {
|
|
||||||
f.splitn(2, '_').next().unwrap()
|
|
||||||
}
|
|
||||||
assert!(key(f1) <= key(f2), "wrong field order: {f1:?} {f2:?}");
|
|
||||||
}
|
|
||||||
|
|
||||||
let map = fields
|
let map = fields
|
||||||
.iter()
|
.iter()
|
||||||
.map(|(field, ty, doc, default)| {
|
.map(|(field, ty, doc, default)| {
|
||||||
|
|
|
@ -108,9 +108,9 @@ pub(super) fn patch_json_for_outdated_configs(json: &mut Value) {
|
||||||
merge(json, json!({ "cargo": { "features": "all" } }));
|
merge(json, json!({ "cargo": { "features": "all" } }));
|
||||||
}
|
}
|
||||||
|
|
||||||
// checkOnSave_allFeatures, checkOnSave_features -> flycheck_features
|
// checkOnSave_allFeatures, checkOnSave_features -> check_features
|
||||||
if let Some(Value::Bool(true)) = copy.pointer("/checkOnSave/allFeatures") {
|
if let Some(Value::Bool(true)) = copy.pointer("/checkOnSave/allFeatures") {
|
||||||
merge(json, json!({ "flycheck": { "features": "all" } }));
|
merge(json, json!({ "check": { "features": "all" } }));
|
||||||
}
|
}
|
||||||
|
|
||||||
// completion_addCallArgumentSnippets completion_addCallParenthesis -> completion_callable_snippets
|
// completion_addCallArgumentSnippets completion_addCallParenthesis -> completion_callable_snippets
|
||||||
|
@ -126,13 +126,13 @@ pub(super) fn patch_json_for_outdated_configs(json: &mut Value) {
|
||||||
merge(json, json!({ "completion": { "callable": {"snippets": res }} }));
|
merge(json, json!({ "completion": { "callable": {"snippets": res }} }));
|
||||||
|
|
||||||
// We need to do this due to the checkOnSave_enable -> checkOnSave change, as that key now can either be an object or a bool
|
// We need to do this due to the checkOnSave_enable -> checkOnSave change, as that key now can either be an object or a bool
|
||||||
// checkOnSave_* -> flycheck_*
|
// checkOnSave_* -> check_*
|
||||||
if let Some(Value::Object(obj)) = copy.pointer("/checkOnSave") {
|
if let Some(Value::Object(obj)) = copy.pointer("/checkOnSave") {
|
||||||
// checkOnSave_enable -> checkOnSave
|
// checkOnSave_enable -> checkOnSave
|
||||||
if let Some(b @ Value::Bool(_)) = obj.get("enable") {
|
if let Some(b @ Value::Bool(_)) = obj.get("enable") {
|
||||||
merge(json, json!({ "checkOnSave": b }));
|
merge(json, json!({ "checkOnSave": b }));
|
||||||
}
|
}
|
||||||
merge(json, json!({ "flycheck": obj }));
|
merge(json, json!({ "check": obj }));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -112,7 +112,93 @@ Unsets `#[cfg(test)]` for the specified crates.
|
||||||
[[rust-analyzer.checkOnSave]]rust-analyzer.checkOnSave (default: `true`)::
|
[[rust-analyzer.checkOnSave]]rust-analyzer.checkOnSave (default: `true`)::
|
||||||
+
|
+
|
||||||
--
|
--
|
||||||
Run the flycheck command for diagnostics on save.
|
Run the check command for diagnostics on save.
|
||||||
|
--
|
||||||
|
[[rust-analyzer.check.allTargets]]rust-analyzer.check.allTargets (default: `true`)::
|
||||||
|
+
|
||||||
|
--
|
||||||
|
Check all targets and tests (`--all-targets`).
|
||||||
|
--
|
||||||
|
[[rust-analyzer.check.command]]rust-analyzer.check.command (default: `"check"`)::
|
||||||
|
+
|
||||||
|
--
|
||||||
|
Cargo command to use for `cargo check`.
|
||||||
|
--
|
||||||
|
[[rust-analyzer.check.extraArgs]]rust-analyzer.check.extraArgs (default: `[]`)::
|
||||||
|
+
|
||||||
|
--
|
||||||
|
Extra arguments for `cargo check`.
|
||||||
|
--
|
||||||
|
[[rust-analyzer.check.extraEnv]]rust-analyzer.check.extraEnv (default: `{}`)::
|
||||||
|
+
|
||||||
|
--
|
||||||
|
Extra environment variables that will be set when running `cargo check`.
|
||||||
|
Extends `#rust-analyzer.cargo.extraEnv#`.
|
||||||
|
--
|
||||||
|
[[rust-analyzer.check.features]]rust-analyzer.check.features (default: `null`)::
|
||||||
|
+
|
||||||
|
--
|
||||||
|
List of features to activate. Defaults to
|
||||||
|
`#rust-analyzer.cargo.features#`.
|
||||||
|
|
||||||
|
Set to `"all"` to pass `--all-features` to Cargo.
|
||||||
|
--
|
||||||
|
[[rust-analyzer.check.invocationLocation]]rust-analyzer.check.invocationLocation (default: `"workspace"`)::
|
||||||
|
+
|
||||||
|
--
|
||||||
|
Specifies the working directory for running checks.
|
||||||
|
- "workspace": run checks for workspaces in the corresponding workspaces' root directories.
|
||||||
|
This falls back to "root" if `#rust-analyzer.cargo.checkOnSave.invocationStrategy#` is set to `once`.
|
||||||
|
- "root": run checks in the project's root directory.
|
||||||
|
This config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`
|
||||||
|
is set.
|
||||||
|
--
|
||||||
|
[[rust-analyzer.check.invocationStrategy]]rust-analyzer.check.invocationStrategy (default: `"per_workspace"`)::
|
||||||
|
+
|
||||||
|
--
|
||||||
|
Specifies the invocation strategy to use when running the checkOnSave command.
|
||||||
|
If `per_workspace` is set, the command will be executed for each workspace.
|
||||||
|
If `once` is set, the command will be executed once.
|
||||||
|
This config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`
|
||||||
|
is set.
|
||||||
|
--
|
||||||
|
[[rust-analyzer.check.noDefaultFeatures]]rust-analyzer.check.noDefaultFeatures (default: `null`)::
|
||||||
|
+
|
||||||
|
--
|
||||||
|
Whether to pass `--no-default-features` to Cargo. Defaults to
|
||||||
|
`#rust-analyzer.cargo.noDefaultFeatures#`.
|
||||||
|
--
|
||||||
|
[[rust-analyzer.check.overrideCommand]]rust-analyzer.check.overrideCommand (default: `null`)::
|
||||||
|
+
|
||||||
|
--
|
||||||
|
Override the command rust-analyzer uses instead of `cargo check` for
|
||||||
|
diagnostics on save. The command is required to output json and
|
||||||
|
should therefore include `--message-format=json` or a similar option.
|
||||||
|
|
||||||
|
If you're changing this because you're using some tool wrapping
|
||||||
|
Cargo, you might also want to change
|
||||||
|
`#rust-analyzer.cargo.buildScripts.overrideCommand#`.
|
||||||
|
|
||||||
|
If there are multiple linked projects, this command is invoked for
|
||||||
|
each of them, with the working directory being the project root
|
||||||
|
(i.e., the folder containing the `Cargo.toml`).
|
||||||
|
|
||||||
|
An example command would be:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cargo check --workspace --message-format=json --all-targets
|
||||||
|
```
|
||||||
|
.
|
||||||
|
--
|
||||||
|
[[rust-analyzer.check.targets]]rust-analyzer.check.targets (default: `null`)::
|
||||||
|
+
|
||||||
|
--
|
||||||
|
Check for specific targets. Defaults to `#rust-analyzer.cargo.target#` if empty.
|
||||||
|
|
||||||
|
Can be a single target, e.g. `"x86_64-unknown-linux-gnu"` or a list of targets, e.g.
|
||||||
|
`["aarch64-apple-darwin", "x86_64-apple-darwin"]`.
|
||||||
|
|
||||||
|
Aliased as `"checkOnSave.targets"`.
|
||||||
--
|
--
|
||||||
[[rust-analyzer.completion.autoimport.enable]]rust-analyzer.completion.autoimport.enable (default: `true`)::
|
[[rust-analyzer.completion.autoimport.enable]]rust-analyzer.completion.autoimport.enable (default: `true`)::
|
||||||
+
|
+
|
||||||
|
@ -241,92 +327,6 @@ also need to add the folders to Code's `files.watcherExclude`.
|
||||||
--
|
--
|
||||||
Controls file watching implementation.
|
Controls file watching implementation.
|
||||||
--
|
--
|
||||||
[[rust-analyzer.flycheck.allTargets]]rust-analyzer.flycheck.allTargets (default: `true`)::
|
|
||||||
+
|
|
||||||
--
|
|
||||||
Check all targets and tests (`--all-targets`).
|
|
||||||
--
|
|
||||||
[[rust-analyzer.flycheck.command]]rust-analyzer.flycheck.command (default: `"check"`)::
|
|
||||||
+
|
|
||||||
--
|
|
||||||
Cargo command to use for `cargo check`.
|
|
||||||
--
|
|
||||||
[[rust-analyzer.flycheck.extraArgs]]rust-analyzer.flycheck.extraArgs (default: `[]`)::
|
|
||||||
+
|
|
||||||
--
|
|
||||||
Extra arguments for `cargo check`.
|
|
||||||
--
|
|
||||||
[[rust-analyzer.flycheck.extraEnv]]rust-analyzer.flycheck.extraEnv (default: `{}`)::
|
|
||||||
+
|
|
||||||
--
|
|
||||||
Extra environment variables that will be set when running `cargo check`.
|
|
||||||
Extends `#rust-analyzer.cargo.extraEnv#`.
|
|
||||||
--
|
|
||||||
[[rust-analyzer.flycheck.features]]rust-analyzer.flycheck.features (default: `null`)::
|
|
||||||
+
|
|
||||||
--
|
|
||||||
List of features to activate. Defaults to
|
|
||||||
`#rust-analyzer.cargo.features#`.
|
|
||||||
|
|
||||||
Set to `"all"` to pass `--all-features` to Cargo.
|
|
||||||
--
|
|
||||||
[[rust-analyzer.flycheck.invocationLocation]]rust-analyzer.flycheck.invocationLocation (default: `"workspace"`)::
|
|
||||||
+
|
|
||||||
--
|
|
||||||
Specifies the working directory for running checks.
|
|
||||||
- "workspace": run checks for workspaces in the corresponding workspaces' root directories.
|
|
||||||
This falls back to "root" if `#rust-analyzer.cargo.checkOnSave.invocationStrategy#` is set to `once`.
|
|
||||||
- "root": run checks in the project's root directory.
|
|
||||||
This config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`
|
|
||||||
is set.
|
|
||||||
--
|
|
||||||
[[rust-analyzer.flycheck.invocationStrategy]]rust-analyzer.flycheck.invocationStrategy (default: `"per_workspace"`)::
|
|
||||||
+
|
|
||||||
--
|
|
||||||
Specifies the invocation strategy to use when running the checkOnSave command.
|
|
||||||
If `per_workspace` is set, the command will be executed for each workspace.
|
|
||||||
If `once` is set, the command will be executed once.
|
|
||||||
This config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`
|
|
||||||
is set.
|
|
||||||
--
|
|
||||||
[[rust-analyzer.flycheck.noDefaultFeatures]]rust-analyzer.flycheck.noDefaultFeatures (default: `null`)::
|
|
||||||
+
|
|
||||||
--
|
|
||||||
Whether to pass `--no-default-features` to Cargo. Defaults to
|
|
||||||
`#rust-analyzer.cargo.noDefaultFeatures#`.
|
|
||||||
--
|
|
||||||
[[rust-analyzer.flycheck.overrideCommand]]rust-analyzer.flycheck.overrideCommand (default: `null`)::
|
|
||||||
+
|
|
||||||
--
|
|
||||||
Override the command rust-analyzer uses instead of `cargo check` for
|
|
||||||
diagnostics on save. The command is required to output json and
|
|
||||||
should therefore include `--message-format=json` or a similar option.
|
|
||||||
|
|
||||||
If you're changing this because you're using some tool wrapping
|
|
||||||
Cargo, you might also want to change
|
|
||||||
`#rust-analyzer.cargo.buildScripts.overrideCommand#`.
|
|
||||||
|
|
||||||
If there are multiple linked projects, this command is invoked for
|
|
||||||
each of them, with the working directory being the project root
|
|
||||||
(i.e., the folder containing the `Cargo.toml`).
|
|
||||||
|
|
||||||
An example command would be:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cargo check --workspace --message-format=json --all-targets
|
|
||||||
```
|
|
||||||
.
|
|
||||||
--
|
|
||||||
[[rust-analyzer.flycheck.targets]]rust-analyzer.flycheck.targets (default: `null`)::
|
|
||||||
+
|
|
||||||
--
|
|
||||||
Check for specific targets. Defaults to `#rust-analyzer.cargo.target#` if empty.
|
|
||||||
|
|
||||||
Can be a single target, e.g. `"x86_64-unknown-linux-gnu"` or a list of targets, e.g.
|
|
||||||
`["aarch64-apple-darwin", "x86_64-apple-darwin"]`.
|
|
||||||
|
|
||||||
Aliased as `"checkOnSave.targets"`.
|
|
||||||
--
|
|
||||||
[[rust-analyzer.highlightRelated.breakPoints.enable]]rust-analyzer.highlightRelated.breakPoints.enable (default: `true`)::
|
[[rust-analyzer.highlightRelated.breakPoints.enable]]rust-analyzer.highlightRelated.breakPoints.enable (default: `true`)::
|
||||||
+
|
+
|
||||||
--
|
--
|
||||||
|
|
|
@ -557,10 +557,120 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rust-analyzer.checkOnSave": {
|
"rust-analyzer.checkOnSave": {
|
||||||
"markdownDescription": "Run the flycheck command for diagnostics on save.",
|
"markdownDescription": "Run the check command for diagnostics on save.",
|
||||||
"default": true,
|
"default": true,
|
||||||
"type": "boolean"
|
"type": "boolean"
|
||||||
},
|
},
|
||||||
|
"rust-analyzer.check.allTargets": {
|
||||||
|
"markdownDescription": "Check all targets and tests (`--all-targets`).",
|
||||||
|
"default": true,
|
||||||
|
"type": "boolean"
|
||||||
|
},
|
||||||
|
"rust-analyzer.check.command": {
|
||||||
|
"markdownDescription": "Cargo command to use for `cargo check`.",
|
||||||
|
"default": "check",
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"rust-analyzer.check.extraArgs": {
|
||||||
|
"markdownDescription": "Extra arguments for `cargo check`.",
|
||||||
|
"default": [],
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rust-analyzer.check.extraEnv": {
|
||||||
|
"markdownDescription": "Extra environment variables that will be set when running `cargo check`.\nExtends `#rust-analyzer.cargo.extraEnv#`.",
|
||||||
|
"default": {},
|
||||||
|
"type": "object"
|
||||||
|
},
|
||||||
|
"rust-analyzer.check.features": {
|
||||||
|
"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,
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"all"
|
||||||
|
],
|
||||||
|
"enumDescriptions": [
|
||||||
|
"Pass `--all-features` to cargo"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rust-analyzer.check.invocationLocation": {
|
||||||
|
"markdownDescription": "Specifies the working directory for running checks.\n- \"workspace\": run checks for workspaces in the corresponding workspaces' root directories.\n This falls back to \"root\" if `#rust-analyzer.cargo.checkOnSave.invocationStrategy#` is set to `once`.\n- \"root\": run checks in the project's root directory.\nThis config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`\nis set.",
|
||||||
|
"default": "workspace",
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"workspace",
|
||||||
|
"root"
|
||||||
|
],
|
||||||
|
"enumDescriptions": [
|
||||||
|
"The command will be executed in the corresponding workspace root.",
|
||||||
|
"The command will be executed in the project root."
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rust-analyzer.check.invocationStrategy": {
|
||||||
|
"markdownDescription": "Specifies the invocation strategy to use when running the checkOnSave command.\nIf `per_workspace` is set, the command will be executed for each workspace.\nIf `once` is set, the command will be executed once.\nThis config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`\nis set.",
|
||||||
|
"default": "per_workspace",
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"per_workspace",
|
||||||
|
"once"
|
||||||
|
],
|
||||||
|
"enumDescriptions": [
|
||||||
|
"The command will be executed for each workspace.",
|
||||||
|
"The command will be executed once."
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rust-analyzer.check.noDefaultFeatures": {
|
||||||
|
"markdownDescription": "Whether to pass `--no-default-features` to Cargo. Defaults to\n`#rust-analyzer.cargo.noDefaultFeatures#`.",
|
||||||
|
"default": null,
|
||||||
|
"type": [
|
||||||
|
"null",
|
||||||
|
"boolean"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"rust-analyzer.check.overrideCommand": {
|
||||||
|
"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\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.",
|
||||||
|
"default": null,
|
||||||
|
"type": [
|
||||||
|
"null",
|
||||||
|
"array"
|
||||||
|
],
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rust-analyzer.check.targets": {
|
||||||
|
"markdownDescription": "Check for specific targets. Defaults to `#rust-analyzer.cargo.target#` if empty.\n\nCan be a single target, e.g. `\"x86_64-unknown-linux-gnu\"` or a list of targets, e.g.\n`[\"aarch64-apple-darwin\", \"x86_64-apple-darwin\"]`.\n\nAliased as `\"checkOnSave.targets\"`.",
|
||||||
|
"default": null,
|
||||||
|
"anyOf": [
|
||||||
|
{
|
||||||
|
"type": "null"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"rust-analyzer.completion.autoimport.enable": {
|
"rust-analyzer.completion.autoimport.enable": {
|
||||||
"markdownDescription": "Toggles the additional completions that automatically add imports when completed.\nNote that your client must specify the `additionalTextEdits` LSP client capability to truly have this feature enabled.",
|
"markdownDescription": "Toggles the additional completions that automatically add imports when completed.\nNote that your client must specify the `additionalTextEdits` LSP client capability to truly have this feature enabled.",
|
||||||
"default": true,
|
"default": true,
|
||||||
|
@ -702,116 +812,6 @@
|
||||||
"Use server-side file watching"
|
"Use server-side file watching"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"rust-analyzer.flycheck.allTargets": {
|
|
||||||
"markdownDescription": "Check all targets and tests (`--all-targets`).",
|
|
||||||
"default": true,
|
|
||||||
"type": "boolean"
|
|
||||||
},
|
|
||||||
"rust-analyzer.flycheck.command": {
|
|
||||||
"markdownDescription": "Cargo command to use for `cargo check`.",
|
|
||||||
"default": "check",
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
"rust-analyzer.flycheck.extraArgs": {
|
|
||||||
"markdownDescription": "Extra arguments for `cargo check`.",
|
|
||||||
"default": [],
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"rust-analyzer.flycheck.extraEnv": {
|
|
||||||
"markdownDescription": "Extra environment variables that will be set when running `cargo check`.\nExtends `#rust-analyzer.cargo.extraEnv#`.",
|
|
||||||
"default": {},
|
|
||||||
"type": "object"
|
|
||||||
},
|
|
||||||
"rust-analyzer.flycheck.features": {
|
|
||||||
"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,
|
|
||||||
"anyOf": [
|
|
||||||
{
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"all"
|
|
||||||
],
|
|
||||||
"enumDescriptions": [
|
|
||||||
"Pass `--all-features` to cargo"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "null"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"rust-analyzer.flycheck.invocationLocation": {
|
|
||||||
"markdownDescription": "Specifies the working directory for running checks.\n- \"workspace\": run checks for workspaces in the corresponding workspaces' root directories.\n This falls back to \"root\" if `#rust-analyzer.cargo.checkOnSave.invocationStrategy#` is set to `once`.\n- \"root\": run checks in the project's root directory.\nThis config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`\nis set.",
|
|
||||||
"default": "workspace",
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"workspace",
|
|
||||||
"root"
|
|
||||||
],
|
|
||||||
"enumDescriptions": [
|
|
||||||
"The command will be executed in the corresponding workspace root.",
|
|
||||||
"The command will be executed in the project root."
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"rust-analyzer.flycheck.invocationStrategy": {
|
|
||||||
"markdownDescription": "Specifies the invocation strategy to use when running the checkOnSave command.\nIf `per_workspace` is set, the command will be executed for each workspace.\nIf `once` is set, the command will be executed once.\nThis config only has an effect when `#rust-analyzer.cargo.buildScripts.overrideCommand#`\nis set.",
|
|
||||||
"default": "per_workspace",
|
|
||||||
"type": "string",
|
|
||||||
"enum": [
|
|
||||||
"per_workspace",
|
|
||||||
"once"
|
|
||||||
],
|
|
||||||
"enumDescriptions": [
|
|
||||||
"The command will be executed for each workspace.",
|
|
||||||
"The command will be executed once."
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"rust-analyzer.flycheck.noDefaultFeatures": {
|
|
||||||
"markdownDescription": "Whether to pass `--no-default-features` to Cargo. Defaults to\n`#rust-analyzer.cargo.noDefaultFeatures#`.",
|
|
||||||
"default": null,
|
|
||||||
"type": [
|
|
||||||
"null",
|
|
||||||
"boolean"
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"rust-analyzer.flycheck.overrideCommand": {
|
|
||||||
"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\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.",
|
|
||||||
"default": null,
|
|
||||||
"type": [
|
|
||||||
"null",
|
|
||||||
"array"
|
|
||||||
],
|
|
||||||
"items": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"rust-analyzer.flycheck.targets": {
|
|
||||||
"markdownDescription": "Check for specific targets. Defaults to `#rust-analyzer.cargo.target#` if empty.\n\nCan be a single target, e.g. `\"x86_64-unknown-linux-gnu\"` or a list of targets, e.g.\n`[\"aarch64-apple-darwin\", \"x86_64-apple-darwin\"]`.\n\nAliased as `\"checkOnSave.targets\"`.",
|
|
||||||
"default": null,
|
|
||||||
"anyOf": [
|
|
||||||
{
|
|
||||||
"type": "null"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "string"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "array",
|
|
||||||
"items": {
|
|
||||||
"type": "string"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"rust-analyzer.highlightRelated.breakPoints.enable": {
|
"rust-analyzer.highlightRelated.breakPoints.enable": {
|
||||||
"markdownDescription": "Enables highlighting of related references while the cursor is on `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,
|
||||||
|
|
Loading…
Reference in a new issue