From a17807d8b10be41df3d5d8916bc51e447bbb3050 Mon Sep 17 00:00:00 2001 From: Peter Tripp Date: Thu, 24 Apr 2025 17:12:41 +0000 Subject: [PATCH] docs: Rust-analyzer example settings for alternate targets (#29353) Release Notes: - N/A --- docs/src/languages/rust.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/src/languages/rust.md b/docs/src/languages/rust.md index 7e8de04fcb24e14a8a35bc82b577d048ff8223af..752567b7870838df9d9e3d5ee5a0abcb6277f7aa 100644 --- a/docs/src/languages/rust.md +++ b/docs/src/languages/rust.md @@ -95,6 +95,30 @@ If you want to use a binary in a custom location, you can specify a `path` and o This `"path"` has to be an absolute path. +## Alternate Targets + +If want rust-analyzer to provide diagnostics for a target other than you current platform (e.g. for windows when running on macOS) you can use the following Zed lsp settings: + +```json +{ + "lsp": { + "rust-analyzer": { + "initialization_options": { + "cargo": { + "target": "x86_64-pc-windows-msvc" + } + } + } + } +} +``` + +If you are using `rustup` and you can find a list of available target triples (`aarch64-apple-darwin`, `x86_64-unknown-linux-gnu`, etc) by running: + +```sh +rustup target list --installed +``` + ## More server configuration