重构: 巨函数拆分 + 清理历史标记注释 + custom_prompt/停止按钮/tunnel 改进
This commit is contained in:
+134
-17
@@ -1,41 +1,71 @@
|
||||
{
|
||||
// 项目级 Zed 配置:优化 rust-analyzer 性能
|
||||
// ── 项目级 Zed 配置: rust-analyzer 性能极限优化 ──────────────
|
||||
//
|
||||
// 背景:本 workspace 含 src-tauri + 7 个 df-* crate,
|
||||
// flycheck 单次产出 600+ 行 artifact JSON,Zed 解析+渲染会冻结 UI。
|
||||
// 核心策略:关掉保存即 check、限定 check 范围、隔离 target 目录。
|
||||
// workspace: src-tauri + 7 个 df-* crate 的 Rust Monorepo
|
||||
// flcheck 单次 600+ 行 artifact JSON → Zed 解析+渲染冻结 UI
|
||||
// 核心策略: 关保存即 check · 限制检查范围 · 裁切 LSP 负载 · 排 IO 争抢
|
||||
// ─────────────────────────────────────────────────────────────────
|
||||
|
||||
"lsp": {
|
||||
"rust-analyzer": {
|
||||
"initialization_options": {
|
||||
// ── cargo 编译参数 ───────────────────────────────────
|
||||
"cargo": {
|
||||
"features": [], // 不编 default features 之外的重头
|
||||
"allTargets": false, // 只为 host target 解析,跳过 musl/交叉
|
||||
"targetDir": null, // 留空用 cargo 默认,避免双写
|
||||
"features": [],
|
||||
"allTargets": false, // 只为 host target 解析
|
||||
"noDefaultFeatures": false,
|
||||
"targetDir": null,
|
||||
"buildScripts": {
|
||||
"enable": true,
|
||||
"invocationStrategy": "once", // 只跑一次,不反复
|
||||
"rerun": "on-save"
|
||||
}
|
||||
},
|
||||
"extraArgs": []
|
||||
},
|
||||
|
||||
// ── check / flycheck ────────────────────────────────
|
||||
"check": {
|
||||
"onSave": false, // ★ 关键!关闭保存即 check(Zed 卡死主因)
|
||||
"workspace": false, // 即便手动 check 也只查当前 crate
|
||||
"command": "check", // 用 cargo check(非 clippy),首次开销低
|
||||
"onSave": false, // ★ 核心!关保存即 check
|
||||
"workspace": false, // 手动 check 也只查当前 crate
|
||||
"command": "check", // 用 check,非 clippy
|
||||
"invocationStrategy": "once", // 只跑一轮,不反复
|
||||
"features": [],
|
||||
"allTargets": false
|
||||
"allTargets": false,
|
||||
"ignore": [ // 跳过不常用的目录
|
||||
"benches",
|
||||
"examples",
|
||||
"xtask",
|
||||
"tests"
|
||||
]
|
||||
},
|
||||
|
||||
// ── 缓存预热(关掉,省首次启动 CPU 爆发) ──────────────
|
||||
"cachePriming": {
|
||||
"enable": false
|
||||
},
|
||||
|
||||
// ── 诊断 ────────────────────────────────────────────
|
||||
"diagnostics": {
|
||||
"enable": true, // 保留 rust-analyzer 自身诊断
|
||||
"enable": true,
|
||||
"experimental": {
|
||||
"enable": false
|
||||
}
|
||||
},
|
||||
"disabled": [ // 关掉非关键诊断,降 CPU
|
||||
"unresolved-proc-macro",
|
||||
"inactive-code",
|
||||
"macro-error"
|
||||
]
|
||||
},
|
||||
|
||||
// ── proc-macro(必须开,否则 tauri 全报红) ────────────
|
||||
"procMacro": {
|
||||
"enable": true, // 必须开,否则 tauri::generate_context 等会报红
|
||||
"enable": true,
|
||||
"attributes": {
|
||||
"enable": true
|
||||
}
|
||||
},
|
||||
|
||||
// ── 符号检索 ────────────────────────────────────────
|
||||
"workspace": {
|
||||
"symbol": {
|
||||
"search": {
|
||||
@@ -44,21 +74,108 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// ── 补全(限流减少 LSP 计算量) ──────────────────────
|
||||
"completion": {
|
||||
"autoclose": true,
|
||||
"autoimport": {
|
||||
"enable": true
|
||||
},
|
||||
"callable": {
|
||||
"snippets": "fill_arguments"
|
||||
},
|
||||
"fullFunction": {
|
||||
"enable": false
|
||||
},
|
||||
"limit": 200, // 补全条目上限
|
||||
"postfix": {
|
||||
"enable": false // 关 postfix snippet 减少候选
|
||||
}
|
||||
},
|
||||
|
||||
// ── 内联提示(大文件里关掉多数减少 UI 重绘) ──────────
|
||||
"inlayHints": {
|
||||
"bindingModeHints": {
|
||||
"enable": false
|
||||
},
|
||||
"chainingHints": {
|
||||
"enable": false
|
||||
},
|
||||
"closingBraceHints": {
|
||||
"enable": false
|
||||
},
|
||||
"closureReturnTypeHints": {
|
||||
"enable": "never"
|
||||
},
|
||||
"constructorHints": "never",
|
||||
"discriminantHints": {
|
||||
"enable": "never"
|
||||
},
|
||||
"expressionAdjustmentHints": {
|
||||
"mode": "never"
|
||||
},
|
||||
"implicitDrops": "never",
|
||||
"lifetimeElisionHints": {
|
||||
"enable": "skip_trivial"
|
||||
},
|
||||
"maxLength": 100,
|
||||
"parameterHints": {
|
||||
"enable": true
|
||||
},
|
||||
"reborrowHints": {
|
||||
"enable": "never"
|
||||
},
|
||||
"renderColons": true,
|
||||
"typeHints": {
|
||||
"enable": true,
|
||||
"hideNamedConstructor": false
|
||||
}
|
||||
},
|
||||
|
||||
// ── 语义高亮(大文件关掉字符串部分减少重绘) ──────────
|
||||
"semanticHighlights": {
|
||||
"strings": {
|
||||
"enable": false
|
||||
}
|
||||
},
|
||||
|
||||
// ── 高亮关联(关掉减少 LSP 图构建) ──────────────────
|
||||
"highlightRelated": {
|
||||
"references": {
|
||||
"enable": false
|
||||
}
|
||||
},
|
||||
|
||||
// ── 测试解释器(关掉) ───────────────────────────────
|
||||
"interpret": {
|
||||
"tests": false
|
||||
},
|
||||
|
||||
// ── rust-analyzer 文件扫描排除 ─────────────────────
|
||||
"files": {
|
||||
"excludeDirs": [".cargo", "target", "target-musl", "node_modules", "dist", ".zed"]
|
||||
"excludeDirs": [
|
||||
".cargo",
|
||||
"target",
|
||||
"target-musl",
|
||||
"node_modules",
|
||||
"dist",
|
||||
".zed",
|
||||
".git"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// ── Zed 文件监视排除(减少 File Watcher IO 争抢) ────────────
|
||||
// 和全局 ~/.config/zed/settings.json 的 file_scan_exclusions 叠加
|
||||
"file_scan_exclusions": [
|
||||
"**/target/**",
|
||||
"**/target-musl/**",
|
||||
"**/node_modules/**",
|
||||
"**/dist/**",
|
||||
"**/.cargo/**",
|
||||
"**/.git/**",
|
||||
"**/build/**"
|
||||
]
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user