feat: add structural completion for mcpp.toml - #9
Open
Ximiaw wants to merge 2 commits into
Open
Conversation
Section-header snippets and writing templates for free-vocabulary sections, computed from a tolerant TOML parser that yields cursor contexts with explicit replacement ranges (unterminated input, CRLF, quoted/dotted keys, nested inline tables). Conditional sections such as [target.<sel>.dependencies] resolve to their base group. No static field keys/enums (waiting for a versioned upstream manifest schema) and no dynamic dependency data (waiting for a batch catalog interface); the completion query layer is provider-dispatch so both can be added back without touching the parser. Contract tests run every registered section header and template key through real mcpp builds (skipped where mcpp is absent). Gated by mcpp.tomlCompletion (default on).
This was referenced Aug 8, 2026
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.
概要
为
mcpp.toml增加结构补全,依据设计 issue #8 的拆分结论,本 PR 只含可先落地的结构层。Supersedes #4。
提供的建议
[package]、[targets.<name>]、[indices]、[pack]等),参数化段带可跳转占位符;[dependencies]的五种依赖写法、[features]表形式、capabilities / xlings / tools.overrides / generated_files 等开放段的条目形态。
明确不含(#8 范围内留待后续,接口已预留)
只读 env resolver。
实现
下钻;输出带 token 位置的光标上下文,每条建议携带显式替换范围,不产生
无效文本;
[target.'cfg(windows)'.dependencies]等正确识别;extension.ts仅 1:1 映射;mcpp.tomlCompletion(resource 域,默认开启);未受信任工作区仅有纯文本补全,不执行任何外部程序(capabilities 描述已同步)。
测试
mcpp build验证,含「条件段拒绝非 build-input 键」反向断言;无 mcpp 环境自动 skip;
已知缺口:vscode 胶水层(设置门 + 1:1 映射)无自动化测试,逻辑刻意压薄;
未知段被 mcpp 静默忽略,段头契约测试对「段被上游删除」不敏感(靠源码出处
注释 + 升级 diff 对照兜底)。