Skip to content

fix: 避免重复配置时清理 PCM 缓存 - #14

Open
helantianshen wants to merge 2 commits into
mcpp-community:mainfrom
helantianshen:fix/preserve-pcm-on-repeat-setup
Open

fix: 避免重复配置时清理 PCM 缓存#14
helantianshen wants to merge 2 commits into
mcpp-community:mainfrom
helantianshen:fix/preserve-pcm-on-repeat-setup

Conversation

@helantianshen

@helantianshen helantianshen commented Aug 11, 2026

Copy link
Copy Markdown

问题

「一键配置模块代码提示」此前无论是否安装或切换 LLVM 工具链,都会执行 mcpp build --no-cache

当项目已经在使用正确的 LLVM 工具链时,重复配置仍会强制清理并重建缓存。clangd 与 compile_commands.json 在重载期间可能继续引用已经失效的 PCM,进而出现 std.pcm: module file not found 等诊断。此时工具链并未发生变化,清理缓存没有必要,也会破坏原本可用的模块产物。

修复

  • 仅在本次流程安装 LLVM 或切换默认工具链时执行 mcpp build --no-cache
  • 工具链没有变化时改为普通的 mcpp build,保留已有 PCM 缓存;
  • 更新模块配置命令测试,分别覆盖工具链变化和复用现有工具链两种情况;
  • 跟踪工作区 TypeScript SDK 设置,使扩展开发统一使用项目安装的 TypeScript。

工具链发生变化时仍然保留原有的无缓存构建行为,避免复用旧工具链生成的 PCM。

验证

  • npm test:266/266 通过
  • npm run package
  • VSIX 归档完整性检查:28 个条目可正常读取
  • VS Code Remote: WSL:清理项目级 .vscode.xlingscompile_commands.json 后,重新执行一键配置和刷新编译数据库均成功
  • Windows 原生 VS Code:LLVM 22.1.8 与 clangd 22.1.8 revision 一致;一键配置和刷新编译数据库均成功
  • WSL 与 Windows 重复执行配置后,不再出现由缓存被清理导致的 PCM 文件丢失

已知限制

消费者源码中的 Module 'mcpplibs.cmp' not found 诊断不属于本 PR;它由后续独立 PR 修复。

@helantianshen helantianshen changed the title fix: 避免重复配置时清理 PCM 缓存 fix: 保留并恢复模块 PCM 缓存 Aug 12, 2026
@helantianshen
helantianshen force-pushed the fix/preserve-pcm-on-repeat-setup branch from 518bd1a to 504eb11 Compare August 12, 2026 08:45
@helantianshen helantianshen changed the title fix: 保留并恢复模块 PCM 缓存 fix: 避免重复配置时清理 PCM 缓存 Aug 12, 2026
@helantianshen
helantianshen marked this pull request as ready for review August 12, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants