fix: xlings 发现以 mcpp self env 为权威来源(项目级契约),路径探测仅作回退 - #11
Merged
wellwei merged 3 commits intoAug 8, 2026
Conversation
mcpp self env 为权威来源(项目级契约),路径探测仅作回退
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
问题
findXlingsExecutable()只探测~/.xlings/**和 PATH,从不检查 mcpp 自带的 xlings。mcpp 是项目级开发环境(社区明确不做的系统级 PATH 集成),其 xlings 由 mcpp 本体托管:
MCPP_PREFIX:$MCPP_HOME/registry/bin/xlings;MCPP_VENDORED_XLINGS固定。结果:标准安装后「一键配置模块代码提示」在 clangd 阶段必然失败(
未找到 xlings … 无法安装匹配的 llvm-tools),无法自动装xim:llvm-tools,也就得不到与 mcpp LLVM 编译器同 revision 的 clangd。修复(遵循"问 mcpp,不猜路径"的项目级契约)
resolveXlingsExecutable(mcppExecutable):优先执行mcpp self env并解析xlings binary = …行——让 mcpp 本体 报告它自己带的 xlings 位置(任何安装布局都成立),确认文件存在才返回;self env失败/无该行时,回退到原有路径探测(兼容独立~/.xlings安装);McppCliController.mcppExecutable改为 public,供向导取当前生效的 mcpp 可执行路径(含mcpp.path配置)。测试
resolveXlingsExecutable用例:self env报告路径命中、报告路径不存在时回退、self env失败时回退;findXlingsExecutable路径探测用例;npm test246/246 通过。相关
实测环境:Linux(Arch/CachyOS) + AUR
mcpp-bin+ install.sh;升级扩展到 0.2.6 后触发。修复后扩展可自动定位 xlings 并完成 llvm-tools 安装与 clangd 匹配。