| // This config uses a separate build directory for rust-analyzer, |
| // so that r-a's checks don't block user `x` commands and vice-verse. |
| // R-a's build directory is located in `build-rust-analyzer`. |
| // |
| // To download rustfmt and proc macro server for r-a run the following command |
| // (proc macro server is downloaded automatically with pretty much any command, |
| // this specific one also downloads rustfmt): |
| // ``` |
| // x fmt --check |
| // ``` |
| // (if that doesn't work -- do `x clean` first) |
| { |
| "git.detectSubmodulesLimit": 20, |
| "rust-analyzer.linkedProjects": [ |
| "Cargo.toml", |
| "compiler/rustc_codegen_cranelift/Cargo.toml", |
| "compiler/rustc_codegen_gcc/Cargo.toml", |
| "library/Cargo.toml", |
| "src/bootstrap/Cargo.toml", |
| "src/tools/rust-analyzer/Cargo.toml" |
| ], |
| "rust-analyzer.check.invocationStrategy": "once", |
| "rust-analyzer.check.overrideCommand": [ |
| "python3", |
| "x.py", |
| "check", |
| "--json-output", |
| "--build-dir", |
| "build-rust-analyzer" |
| ], |
| "rust-analyzer.rustfmt.overrideCommand": [ |
| "${workspaceFolder}/build/host/rustfmt/bin/rustfmt", |
| "--edition=2024" |
| ], |
| "rust-analyzer.procMacro.server": "${workspaceFolder}/build/host/stage0/libexec/rust-analyzer-proc-macro-srv", |
| "rust-analyzer.procMacro.enable": true, |
| "rust-analyzer.rustc.source": "./Cargo.toml", |
| "rust-analyzer.cargo.sysrootSrc": "./library", |
| "rust-analyzer.cargo.extraEnv": { |
| "RUSTC_BOOTSTRAP": "1" |
| }, |
| "rust-analyzer.cargo.buildScripts.enable": true, |
| "rust-analyzer.cargo.buildScripts.invocationStrategy": "once", |
| "rust-analyzer.cargo.buildScripts.overrideCommand": [ |
| "python3", |
| "x.py", |
| "check", |
| "--json-output", |
| "--compile-time-deps", |
| "--build-dir", |
| "build-rust-analyzer" |
| ], |
| "rust-analyzer.server.extraEnv": { |
| "RUSTC": "${workspaceFolder}/build/host/stage0/bin/rustc", |
| "CARGO": "${workspaceFolder}/build/host/stage0/bin/cargo" |
| }, |
| "files.associations": { |
| "*.fixed": "rust", |
| "*.pp": "rust", |
| "*.mir": "rust" |
| } |
| } |