{ // 项目级 Zed 配置:优化 rust-analyzer 性能 // // 背景:本 workspace 含 src-tauri + 7 个 df-* crate, // flycheck 单次产出 600+ 行 artifact JSON,Zed 解析+渲染会冻结 UI。 // 核心策略:关掉保存即 check、限定 check 范围、隔离 target 目录。 "lsp": { "rust-analyzer": { "initialization_options": { "cargo": { "features": [], // 不编 default features 之外的重头 "allTargets": false, // 只为 host target 解析,跳过 musl/交叉 "targetDir": null, // 留空用 cargo 默认,避免双写 "buildScripts": { "enable": true, "rerun": "on-save" } }, "check": { "onSave": false, // ★ 关键!关闭保存即 check(Zed 卡死主因) "workspace": false, // 即便手动 check 也只查当前 crate "command": "check", // 用 cargo check(非 clippy),首次开销低 "features": [], "allTargets": false }, "diagnostics": { "enable": true, // 保留 rust-analyzer 自身诊断 "experimental": { "enable": false } }, "procMacro": { "enable": true, // 必须开,否则 tauri::generate_context 等会报红 "attributes": { "enable": true } }, "workspace": { "symbol": { "search": { "kind": "only_types", "limit": 64 } } }, "completion": { "callable": { "snippets": "fill_arguments" }, "fullFunction": { "enable": false } }, "interpret": { "tests": false }, "files": { "excludeDirs": [".cargo", "target", "target-musl", "node_modules", "dist", ".zed"] } } } } }