From f84f3ffeb7fc1f661f4af4d7c4fd37b8f5e736ff Mon Sep 17 00:00:00 2001 From: Gherman Date: Wed, 30 Oct 2024 15:43:44 +0000 Subject: [PATCH] docs: Add `linkedProjects` section to Rust docs (#19954) Related to #19897 Adds a section about multi-project workspaces and how to configure rust-analyzer to diagnose them even if the cargo workspace does not list them Release Notes: - N/A --------- Co-authored-by: Marshall Bowers --- docs/src/languages/rust.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/docs/src/languages/rust.md b/docs/src/languages/rust.md index 330b5fa9d0151..2af91f1fdc786 100644 --- a/docs/src/languages/rust.md +++ b/docs/src/languages/rust.md @@ -163,6 +163,23 @@ Here's a snippet for Zed settings.json (the language server will restart automat } ``` +### Multi-project workspaces + +If you want rust-analyzer to analyze multiple Rust projects in the same folder that are not listed in `[members]` in the Cargo workspace, +you can list them in `linkedProjects` in the local project settings: + +```json +{ + "lsp": { + "rust-analyzer": { + "initialization_options": { + "linkedProjects": ["./path/to/a/Cargo.toml", "./path/to/b/Cargo.toml"] + } + } + } +} +``` + ### Snippets There's a way get custom completion items from rust-analyzer, that will transform the code according to the snippet body: