Repository navigation
Add C_Cpp.intelliSenseModuleSearchPath for module import IntelliSense - #14894
Open
soroshsabz wants to merge 2 commits into
Open
soroshsabz wants to merge 2 commits into
soroshsabz wants to merge 2 commits into
Conversation
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.
Motivation
Follow-up to #14837 (the
CppModulesProjecttest scenario) and the extension-side part of #6302 (IntelliSense for C++20 modules importing in gcc/clang projects).Module IntelliSense for gcc/clang-mode projects has been blocked by two things:
importdirectives in every mode, but GCC/Clang toolchains produce their own binary module formats (.gcm,.pcm) which the engine cannot read, and the MSVC-style search-dir compiler arguments are not processed in gcc/clang modes. The engine can, however, read its own.eifcmodule interface files in every mode, and it searches the directory named by theEDG_MODULES_PATHenvironment variable (inherited from the extension host by the language server process)..eifcfiles, so even with a search path there was nothing for the engine to find.This PR adds the extension-side workflow that resolves both, in every IntelliSense mode.
What this PR adds
1. New setting
C_Cpp.intelliSenseModuleSearchPath(string,${workspaceFolder}supported): the directory searched for module interface files when resolvingimportdirectives. It is passed to the language server throughEDG_MODULES_PATHat server startup (composited with the existing sanitizer-env mechanism; inherited unchanged when unset).2. New setting
C_Cpp.intelliSenseModuleCompilerPath: a C/C++ front end command that compiles the workspace's module interface units (.cppm/.ixx/.ccm) into.eifcmodule interface files, soimportresolution works without any manual per-module setup. Build the command from the open-source EDG front end (edgcpp/compiler; gnu emulation mode interfaces are supported since edgcpp/compiler#315). The extension:.eifcfile is missing or older than the source (sequentially, per-file timeout, output logged to the C/C++ output channel),C_Cpp.intelliSenseModuleSearchPathwhen set, otherwise a per-workspace cache directory under the extension's default cache root),EDG_MODULES_PATHat that directory.This replaces the closed-source-only workflow with an open one: the module interface files that IntelliSense consumes are produced by the same open-source front end that anyone can build and audit.
3. Tests:
CppModulesProject(running first, before the language server starts): with a module interface compiler configured (a test fake that produces the checked-in.eifcfiles) and the search path set, the test asserts that the generated files appear in the target directory and thatimport math;/import geometry;resolve in gcc mode — hovering over an imported function and over a variable exported from inside a namespace works, and the "could not find module file" diagnostics are gone. The.eifcfixtures were produced with the open-source EDG front end. The test dynamically skips its semantic assertions (with a console warning) if a future language server build can no longer read the checked-in fixtures, so module file format churn cannot turn CI red.Validation
CppModulesProjectscenario tests pass against the shipped 1.36.0 binaries, including the new end-to-end test with semantic assertions on both function and variable imports.Notes
import std;, variable templates, static data members) are tracked in the EDG IFC tracking issues ([GNATS 28269] [EDG IFC] Macros edgcpp/compiler#59, Clang/LLDB support #60, IntelliSense does not work on Win10 #61, Completion options at wrong places #70, libc includes not found in vs code #73, if define MACRO, c++ Syntax colorization and highlighting is error #74, Allow breakpoints in other native languages source files #75, How can i attach to a remote C++ application? #78, Enhance symbol indexing #355); this PR's mechanisms are independent of them and already usable for named-module projects.Related: #6302, #14837, edgcpp/compiler#315, edgcpp/compiler#631