Skip to content

Intellisense doesn't parse system includes correctly #12736

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

Closed
nolankramer opened this issue Sep 19, 2024 · 5 comments
Closed

Intellisense doesn't parse system includes correctly #12736

nolankramer opened this issue Sep 19, 2024 · 5 comments
Assignees
Labels
Language Service more info needed The issue report is not actionable in its current state

Comments

@nolankramer
Copy link

nolankramer commented Sep 19, 2024

Type: Bug

System includes are completely broken with clang and libstdc++. Intellisense claims std::filesystem::path is not a type, among other things.

This obviously causes a massive amount of "errors" to show up in the editor.

Here's my clang -v:

Ubuntu clang version 18.1.3 (1ubuntu1)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Found candidate GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/13
Selected GCC installation: /usr/bin/../lib/gcc/x86_64-linux-gnu/13
Candidate multilib: .;@m64
Selected multilib: .;@m64

And my Linux configuration in c_cpp_properties.json:

{
            "name": "Linux",
            "includePath": [
                "${workspaceFolder}/**"
            ],
            "defines": [],
            "compilerPath": "/usr/bin/clang++",
            "cStandard": "c17",
            "cppStandard": "c++17",
            "intelliSenseMode": "linux-clang-x64",
            "configurationProvider": "ms-vscode.cmake-tools"
        }

The std version being passed into the compile commands is: -std=gnu++17

Extension version: 1.21.6
VS Code version: Code 1.93.1 (38c31bc77e0dd6ae88a4e9cc93428cc27a56ba40, 2024-09-11T17:20:05.685Z)
OS version: Linux x64 6.8.0-45-generic snap
Modes:

System Info
Item Value
CPUs AMD Ryzen 7 PRO 6850H with Radeon Graphics (16 x 2393)
GPU Status 2d_canvas: unavailable_software
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: disabled_software
multiple_raster_threads: enabled_on
opengl: disabled_off
rasterization: disabled_software
raw_draw: disabled_off_ok
skia_graphite: disabled_off
video_decode: disabled_software
video_encode: disabled_software
vulkan: disabled_off
webgl: unavailable_software
webgl2: unavailable_software
webgpu: disabled_off
webnn: disabled_off
Load (avg) 2, 1, 2
Memory (System) 14.89GB (7.96GB free)
Process Argv --no-sandbox --force-user-env --crash-reporter-id 0075ae52-00ae-4c27-9257-6ea0067d3b86
Screen Reader no
VM 0%
DESKTOP_SESSION plasma
XDG_CURRENT_DESKTOP KDE
XDG_SESSION_DESKTOP KDE
XDG_SESSION_TYPE x11
A/B Experiments
vsliv368cf:30146710
vspor879:30202332
vspor708:30202333
vspor363:30204092
vswsl492:30256859
vscod805cf:30301675
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
a9j8j154:30646983
962ge761:30959799
pythongtdpath:30769146
welcomedialogc:30910334
pythonnoceb:30805159
asynctok:30898717
pythonmypyd1:30879173
2e7ec940:31000449
pythontbext0:30879054
accentitlementst:30995554
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
dsvsc021:30996838
g316j359:31013175
a69g1124:31058053
dvdeprecation:31068756
dwnewjupytercf:31046870
newcmakeconfigv2:31071590
impr_priority:31102340
nativerepl2:31139839
refactort:31108082
pythonrstrctxt:31112756
flightc:31134773
wkspc-onlycs-t:31132770
wkspc-ranged-c:31125598
pme_test_t:31118333
ei213698:31121563
iacca1:31138162

@Colengms
Copy link
Contributor

Hi @nolankramer . I'm not easily able to repro an issue with the configuration you provided (without the custom configuration provider specified), clang 18.1.3, and the following code:

#include <filesystem>

void foo()
{
    std::filesystem::path a;
}

However, your configuration does include:

"configurationProvider": "ms-vscode.cmake-tools"

So your IntelliSense configuration may be based on whatever CMake Tools has provided (which would require a CMakeLists.txt and have specified the source file there).

We are aware of the following issue with clang 18. You might try the work around here: #12618

@Colengms Colengms self-assigned this Sep 19, 2024
@Colengms Colengms added Language Service more info needed The issue report is not actionable in its current state labels Sep 19, 2024
@nolankramer
Copy link
Author

Thanks for the reply @Colengms ! I tried the workaround, but no luck - same issues.

How can I provide more information about the CMake setup without pasting the CMakeLists.txt here, since the project is proprietary?

Is there specific CMake values you'd like to know about?

If it helps, here's the clang switches I see in the compile_commands.json: -g -fstandalone-debug -std=gnu++17

@nolankramer
Copy link
Author

Interestingly, removing the "configurationProvider": "ms-vscode.cmake-tools" configuration value does fix the issue. Which makes me wonder what I could possibly be doing wrong in the CMakeLists.txt...

@bobbrow
Copy link
Member

bobbrow commented Sep 20, 2024

I tried the workaround, but no luck - same issues.

If you are using the configuration provider, I believe the workaround also required setting mergeConfigurations to true. However, we put the workaround into our main configurations starting in 1.22.4 so that it should hopefully apply globally to everyone without having to fiddle with configurations.

@nolankramer
Copy link
Author

Yes it looks like setting mergeConfigurations to true fixes the issue when using the configuration provider.

This can be closed since there are now two solutions, with backend changes pending to ease setup.

@github-project-automation github-project-automation bot moved this to Done in cpptools Sep 21, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Nov 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Language Service more info needed The issue report is not actionable in its current state
Projects
Status: Done
Development

No branches or pull requests

3 participants