From 4af9829dcfe906cbe04aba247bc3759cab787a9e Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 19 Aug 2022 08:23:58 -0400 Subject: [PATCH 1/2] document interaction of checkOnSave.overrideCommand and multiple linked projects --- crates/rust-analyzer/src/config.rs | 4 ++++ docs/user/generated_config.adoc | 4 ++++ editors/code/package.json | 2 +- 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index e63cfb163caa..35df7663be25 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs @@ -120,6 +120,10 @@ config_data! { /// 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 diff --git a/docs/user/generated_config.adoc b/docs/user/generated_config.adoc index e3dbeec1fbd2..751ec79af0fd 100644 --- a/docs/user/generated_config.adoc +++ b/docs/user/generated_config.adoc @@ -118,6 +118,10 @@ 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 diff --git a/editors/code/package.json b/editors/code/package.json index 2e38c0573025..67eabc313c83 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -547,7 +547,7 @@ ] }, "rust-analyzer.checkOnSave.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 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.", + "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\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", From c5455d1af3aee9fa73d10fd8e7043098472fe070 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 19 Aug 2022 08:58:08 -0400 Subject: [PATCH 2/2] explain how to re-generate the package.json --- crates/rust-analyzer/src/config.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/rust-analyzer/src/config.rs b/crates/rust-analyzer/src/config.rs index 35df7663be25..6649f42b4ef9 100644 --- a/crates/rust-analyzer/src/config.rs +++ b/crates/rust-analyzer/src/config.rs @@ -45,7 +45,8 @@ mod patch_old_style; // - foo_command = overrides the subcommand, foo_overrideCommand allows full overwriting, extra args only applies for foo_command // Defines the server-side configuration of the rust-analyzer. We generate -// *parts* of VS Code's `package.json` config from this. +// *parts* of VS Code's `package.json` config from this. Run `cargo test` to +// re-generate that file. // // However, editor specific config, which the server doesn't know about, should // be specified directly in `package.json`.