Skip to content

Add CppModulesProject test scenario for C++20 modules groundwork - #14837

Open
soroshsabz wants to merge 5 commits into
microsoft:mainfrom
soroshsabz:feature/cpp-modules-test-scenario
Open

soroshsabz wants to merge 5 commits into
microsoft:mainfrom
soroshsabz:feature/cpp-modules-test-scenario

Conversation

@soroshsabz

Copy link
Copy Markdown

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:

  • module interface files (.cppm/.ixx) being recognized as C++ sources,
  • compile_commands.json entries containing GCC module flags (-fmodules-ts, -fprebuilt-module-path, -fmodule-file) not preventing IntelliSense,
  • module-related compiler arguments (both GCC and MSVC spellings) surviving the custom configuration provider path unmodified.

This PR adds a CppModulesProject test 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

  1. File classification — .cppm/.ixx files open with the cpp language id (guards the file associations that module files depend on for any IntelliSense at all).
  2. compile_commands.json with GCC module flags — a runtime-generated compile_commands.json (with the fake gcc checked into the scenario assets, following the SimpleCppProject pattern) carries the GCC module flags for an importer and two module interface units; IntelliSense reaches IntelliSenseReady for the importer.
  3. Custom configuration provider — a v6 provider returns configurations carrying GCC-style (-fmodules-ts, -fprebuilt-module-path=..., -fmodule-file=...) and MSVC-style (/ifcSearchDir, /reference, /headerUnit, /stdIfcDir) module arguments; the tests assert the configurations are accepted/delivered and the files become ready. The extension-side handling that carries the MSVC modules workaround around has regressed before (the /ifcSearchDir//reference processing regression discussed in Add IntelliSense for C++20 modules importing #6302), so this is worth guarding.

Notes

  • No product behavior change — tests and CI wiring only.
  • CI: one new Windows step (yarn test --scenario=CppModulesProject) mirroring the existing SimpleCppProject step. Happy to drop it or extend it to other platforms per maintainer preference.
  • Context: the engine-side prerequisite for gcc-dialect modules is progressing in the now-open EDG front end (C++20 modules: support gnu emulation modes and extended floating-point types edgcpp/compiler#315 fixes IFC generation in gnu emulation modes); this scenario is the extension-side acceptance harness for when that support reaches the shipped binaries.

Related: #6302

@soroshsabz
soroshsabz requested a review from a team as a code owner October 16, 2026 16:47
@github-project-automation github-project-automation Bot moved this to Pull Request in cpptools Oct 16, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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.

Comment thread Extension/test/scenarios/CppModulesProject/tests/modules.integration.test.ts Outdated
Comment thread Extension/test/scenarios/CppModulesProject/tests/modules.integration.test.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

Static review identified no unresolved blocking issues in the test-only scenario, fixtures, or CI wiring.

1 open issue
1 resolved since last review

Review effort: Balanced

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Pull Request

Development

Successfully merging this pull request may close these issues.

2 participants