-
Notifications
You must be signed in to change notification settings - Fork 454
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suppress "Unable to resolve configuration with compilerPath" warning in CMake+Swift projects #4097
Comments
I'd be happy to submit a PR but I can't find how the string is referenced: |
I don't think you need a PR, can you just set the |
As far as I know there's no way to override configuration provider's compiler path. |
Why is our extension being run on Swift files? We don't currently support Swift. Can the files.associations be changed such that our extension doesn't process the files? |
There are C files in the workspace, so we get activated and will try to get the system includes before we index it. |
@bobbrow You mean .c files that are actually Swift files? That should be fixed by setting files.associations appropriately, such as
Or CMake Tools or some Swift extension or us could maybe do that automatically? I don't think it matters if we're activated if the file is not associated with C/C++ then we won't process it, although maybe setting the files.association might also fix the activation. |
I've boiled it down to a more minimal repro where nothing should cause the C/C++ extension to be involved
cmake_minimum_required(VERSION 3.21.0)
project(Repro LANGUAGES Swift)
{
"version": 3,
"configurePresets": [
{
"name": "default",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build"
}
],
"buildPresets": [
{
"name": "default",
"configurePreset": "default"
}
]
}
{
"C_Cpp.configurationWarnings": "disabled"
}
A few seconds after CMake configure completes, the focus switches to the
(note that the CMake should be able to report a per-language compiler path so it seems like a bug that the C/C++ Extension ends up with the |
Thanks for the update @tristanlabelle, I'm sorry, I gave you wrong information about that setting. It does not actually control this scenario. I don't currently see any way to disable that behavior besides disabling the C++ extension for that workspace. CMake Tools activates the C++ extension automatically because it calls our API. It's possible that CMake Tools could be improved to not call our API and activate our extension if it detects that there is no C or C++ code that needs configurations, but in the meantime, if you don't need C++ support active, there should be no harm in disabling the extension for that workspace. To do this, go to the Extensions tab and click the gear for the extension (lower right corner): |
Thanks as well for the follow-up. Unfortunately, this solution would regress our developer experience. While I am able to reproduce the issue with a minimal Swift-only project, all of the real-world projects in which we encounter this bug (including The Browser Company's main codebase) have a mix of Swift and C/C++ files. This interoperability is also a selling point of Swift, so it's a common scenario. There's a few ways this could be solved (best to worse):
|
It seems likely that the issue is in this integration: vscode-cmake-tools/src/cpptools.ts Line 508 in d860f08
|
@gcampbell-msft Should this be moved to the vscode-cmake-tools repo? |
@tristanlabelle @gcampbell-msft, my guess is that CMake Tools should skip the SWIFT compiler kind of like what we did for RC a long time ago. I think the fix would go here: vscode-cmake-tools/src/cpptools.ts Line 434 in d860f08
|
Ping @gcampbell-msft ! |
@tristanlabelle When we use the reproduction steps you provided to reproduce the issue, we get this error, can you give some advice? |
@v-frankwang , it looks like you don't have Swift installed as in my repro steps. |
@tristanlabelle I still get the error after installing the Swift compiler. |
@v-frankwang please make sure to open VS Code from a VS Developer Command prompt which reports x64 for both host and target:
You might want to use the explicit |
@tristanlabelle For the fix that @bobbrow pointed out, is the filegroup language for swift simply "swift"? |
@gcampbell-msft , I don't know what that |
@tristanlabelle I'll investigate, thanks. |
@tristanlabelle Could you test out the fix in this vsix? You'll have to change the file extension from .zip to .vsix after downloading. |
@gcampbell-msft Sorry for the wait. Yup! That fixed it with my repro. Mind @'ing me in the PR? |
Environment
Bug Summary and Steps to Reproduce
Bug Summary:
While working on a CMake Swift project, the C++ extension will regularly print the message below to the
C/C++ Configuration Warnings
output window righ after a build, which is annoying because:CMake/Build
output pane, hiding the output of the buildswiftc.exe
compilerSteps to reproduce:
Generator
subfolder in VS Code from a VS dev cmdcmake --preset debug
andcmake --build --preset debug
(the bug is not specific to this repo, I see it regularly when working in Swift)
Expected behavior:
The C/C++ extension should not produce this warning. Probably it should ignore anything to do with the Swift compiler.
Configuration and Logs
The text was updated successfully, but these errors were encountered: