Repository navigation
Add CppModulesProject test scenario for C++20 modules groundwork - #14837
soroshsabz wants to merge 11 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The tests do not establish compilation-database use or preservation of delivered module arguments.
2 open findings
What changed in this PR
Adds C++20 modules test groundwork for extension-side behavior while semantic module-import support remains under development.
Changes:
- Adds file-classification, compilation-database, and custom-provider tests.
- Adds module fixtures and fake compiler assets.
- Runs the scenario in Windows CI.
| File | Description |
|---|---|
| Extension/test/scenarios/CppModulesProject/tests/modules.integration.test.ts | Adds module scenario tests. |
| Extension/test/scenarios/CppModulesProject/assets/math.ixx | Adds geometry module interface. |
| Extension/test/scenarios/CppModulesProject/assets/math.cppm | Adds math module interface. |
| Extension/test/scenarios/CppModulesProject/assets/main3.cpp | Adds MSVC-provider importer. |
| Extension/test/scenarios/CppModulesProject/assets/main2.cpp | Adds GCC-provider importer. |
| Extension/test/scenarios/CppModulesProject/assets/main.cpp | Adds compilation-database importer. |
| Extension/test/scenarios/CppModulesProject/assets/bin/gcc.exe | Adds Windows fake compiler. |
| Extension/test/scenarios/CppModulesProject/assets/bin/gcc | Adds non-Windows fake compiler. |
| Extension/test/scenarios/CppModulesProject/assets/.gitignore | Ignores generated configuration files. |
| .github/workflows/job-compile-and-test.yml | Adds Windows scenario execution. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
|
Sean McManus (@sean-mcmanus) Is there anything else I can do? |
|
As you can see edgcpp/compiler#315 has been merged So please review this PR, I want to submit another PR for implement required features |
|
Sean McManus (@sean-mcmanus) Could you run CI for this PR? thanks |
|
soroshsabz My apologies -- I am and have been super busy recently. |
|
Sean McManus (@sean-mcmanus) Ok, I am waiting for you |
|
Sean McManus (@sean-mcmanus) could you review this PR again? and run CI? thanks :) |
|
The follow-up push (5061b9e) implements the narrowing requested in the review: comment-only changes (test file header, provider suite, PR description) stating precisely what the sentinel does and does not verify -- no module-switch-level detection, Clang covered via the compilation database rather than the provider -- with per-flag assertions and event-driven synchronization noted as follow-ups. 6/6 scenario tests still pass against the shipped binaries. The push auto-dismissed the approval; nothing functional changed. |
|
Colen Garoutte-Carson (@Colengc) Could you please review this PR? thanks :) |
The plan is for next Monday. |

Motivation
IntelliSense support for C++20 modules importing (#6302) is still in development on the language server side. Meanwhile, module-based projects already exercise extension-side behavior that currently has no test coverage:
.cppm/.ixx) being recognized as C++ sources,compile_commands.jsonentries containing compiler module flags not preventing IntelliSense,This PR adds a
CppModulesProjecttest scenario that locks that behavior in. It makes no statement about the semantic understanding of module imports by the language server — when server-side support lands, these tests are the natural place to add the end-to-end module IntelliSense assertions.What the tests cover
File classification —
.cppm/.ixxfiles open with thecpplanguage id (guards the file associations that module files depend on for any IntelliSense at all).compile_commands.jsonwith module flags, per compiler — a runtime-generated database (with fakegcc/clang++checked into the scenario assets, following theSimpleCppProjectpattern) carries compiler-accurate module flags:main.cpp):-std=c++20 -fmodules-ts(the module flag g++ accepts; GCC does not accept Clang's-fprebuilt-module-path/-fmodule-filespellings)main4.cpp):-std=c++20 -fmodules -fprebuilt-module-path=... -fmodule-file=math=...pcmEach importer's entry also carries a sentinel define in the same
argumentsarray as the module flags, and the tests hover over a symbol that is only declared under the corresponding#ifdef: the hover resolves if and only if the database entry (module flags included) was actually applied to the translation unit, rather than IntelliSense falling back to a default configuration.Custom configuration provider (GCC and MSVC spellings; Clang is exercised through the compilation database suite above, not through the provider) — a v6 provider returns configurations carrying GCC-style (
gcccompilerPath +-std=c++20 -fmodules-ts) and MSVC-style (clcompilerPath +/ifcSearchDir,/reference,/headerUnit:angle,/stdIfcDir) module arguments. The verification is effect-based but partial by design: a sentinel define travels in the samecompilerArgsarray as the module flags, and the hover assertions prove thatcompilerArgsreach the language server and take effect — dropping or rewriting the array would fail the tests. They do not verify each module switch individually: a flag removed selectively while the sentinel remains would not be detected. Per-flag assertions would require observing module semantics, which are not available yet; that is a possible follow-up, as is event-driven synchronization in place of the fixed (repo-conventional) configuration wait.Notes
yarn test --scenario=CppModulesProject) mirroring the existingSimpleCppProjectstep. Happy to drop it or extend it to other platforms per maintainer preference.Related: #6302