{{ message }}
feat: add opt-in code completion for mcpp.toml - #4
Closed
Ximiaw wants to merge 8 commits into
Closed
Conversation
Suggest section headers, per-section keys, and enum/boolean values aligned with docs/zh/05-mcpp-toml.md, plus long-form spec keys inside dependency and feature inline tables. Registered for the mcpp-toml language with onLanguage activation; completion logic is a pure module covered by node:test cases.
Empty positions in [dependencies], [features], [generated_files], [capabilities], [xlings.workspace], [xlings.envs] and [tools.overrides] now offer snippet templates of the common forms instead of nothing. Also use Folder/EnumMember/Snippet completion item kinds so section, key and value suggestions render with fitting icons.
Add key completions for [build.cxx_runtime] (default/tests), [resources.version-info] and [runtime."<cap>"] (provider), and the [build].profile alias of default-profile, all per docs/zh/05-mcpp-toml.md.
Offer glob/cflags/cxxflags/asmflags/defines inside [build].flags and feature flags inline-table entries (docs/zh/05-mcpp-toml.md section 2.3/2.8). SectionSpec no longer carries key data; section lookup reads SECTION_GROUPS only.
Bare dotted dependency keys (capi.lua, imgui.backend.glfw_opengl3) now parse as key=value positions instead of falling back to template suggestions. Sections are tri-state: document top offers section headers, unknown custom sections offer nothing (appendix A: custom toml keys are unsupported), known groups offer their keys.
The mcpp.toml field set spans more than docs/zh/05-mcpp-toml.md: - [workspace] members/exclude and [workspace.dependencies] with namespace subtables (06-workspace.md) - [package].namespace and the dependency spec workspace = true inheritance key (06-workspace.md) - [toolchain] per-platform pins linux/macos/windows and [build].target with the documented target vocabulary (03-toolchains.md) - linkage = "dynamic" alongside static (03-toolchains.md)
[pack] default_mode/include/exclude and [pack.bundle-project] also_skip/force_bundle per docs/zh/02-pack-and-release.md. All zh docs (00-10) are now swept for mcpp.toml sections; no others define new manifest tables.
New mcpp.tomlCompletion boolean setting (resource scope, default false); the completion provider returns nothing until it is enabled.
10 tasks
Member
This was referenced Aug 8, 2026
Member
Author
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增加代码补全(默认关闭,经mcpp.tomlCompletion设置开启)。字段表对齐 mcpp 主仓库文档:docs/zh/05-mcpp-toml.md 为主,并覆盖
02-pack-and-release.md([pack])、03-toolchains.md([toolchain] 平台 pin、
[build].target、linkage 取值)、06-workspace.md([workspace]、
[package].namespace、依赖 spec 的 workspace 继承键)。
补全内容
参数化段插入 snippet 占位符
platforms、default_profile/profile、linkage、opt 及布尔键
reexport/workspace 等)与 feature(defines/implies/sources/requires 等)
glob/cflags/cxxflags/asmflags/defines
未识别的自定义段不提供建议(附录 A:不支持包自定义键)
实现
extension.ts 只做 CompletionItem 映射;段头建议覆盖已输入的
[前缀onLanguage:mcpp-toml激活事件mcpp.tomlCompletion设置(resource 作用域,默认 false):该功能尚不完善,字段表可能滞后于 mcpp 演进,故默认关闭
测试
点式选择器键/未知段等场景