microsoft / vscode-cpptools

Official repository for the Microsoft C/C++ extension for VS Code.
Other
5.51k stars 1.55k forks source link

IntelliSense gets stuck on Parsing workspace files, usually between 20% to 40%. #12830

Open alanpawlak opened 1 week ago

alanpawlak commented 1 week ago

Environment

Bug Summary and Steps to Reproduce

Bug Summary:

I created a simple project to try the Tracy profiler (https://github.com/wolfpld/tracy).

Steps to Reproduce:

  1. Start VSCode and open my workspace
  2. IntelliSense begins parsing, and I can see it becoming active as I follow the paths
  3. It gets stuck halfway through (or earlier; it's random) and becomes unresponsive

Image

My project files (without tracy repo) tracy-test.zip

Full logs logs.zip

Expected Behavior:

IntelliSense should successfully finish parsing and continue working as expected.

Configuration and Logs

-------- Diagnostics - 10/10/2024, 9:54:32 PM Version: 1.21.6 Current Configuration: { "name": "Win32", "includePath": [ "c:/Developement/tracy-test/", "c:/Developement/tracy-test/tracy/public/tracy/" ], "defines": [ "_DEBUG", "UNICODE", "_UNICODE" ], "windowsSdkVersion": "10.0.19041.0", "compilerPath": "cl.exe", "cStandard": "c17", "cppStandard": "c++17", "compilerPathInCppPropertiesJson": "cl.exe", "intelliSenseMode": "msvc-x64", "intelliSenseModeIsExplicit": true, "cStandardIsExplicit": false, "cppStandardIsExplicit": false, "mergeConfigurations": true, "compilerPathIsExplicit": false, "configurationProvider": "ms-vscode.makefile-tools", "browse": { "path": [ "c:/Developement/tracy-test/", "c:/Developement/tracy-test/tracy/public/tracy/", "${workspaceFolder}" ], "limitSymbolsToIncludedHeaders": true } } cpptools version (native): 1.21.6.0 Translation Unit Mappings: [ C:\Developement\tracy-test\main.cpp - source TU]: Translation Unit Configurations: [ C:\Developement\tracy-test\main.cpp ]: Process ID: 10752 Memory Usage: 167 MB Compiler Path: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\bin\Hostx64\x64\cl.exe Includes: C:\Developement\tracy-test C:\Developement\tracy-test\tracy\public\tracy System Includes: C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\include C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.31.31103\atlmfc\include C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\um C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\ucrt C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\shared C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\winrt C:\Program Files (x86)\Windows Kits\10\Include\10.0.19041.0\cppwinrt Defines: TRACY_ENABLE _DEBUG UNICODE _UNICODE Standard Version: ms_c++17 IntelliSense Mode: windows-msvc-x64 Total Memory Usage: 167 MB

------- Workspace parsing diagnostics ------- Number of files discovered (not excluded): 5293

sean-mcmanus commented 1 week ago

@alanpawlak The C:\Developement\tracy-test\tracy\profiler\src\profiler\TracyMicroArchitecture.cpp file is too large. Can you add "${workspaceFolder}/profiler/src/profiler to your C_Cpp.files.exclude setting? You could also exclude just that particular file, if you set C_Cpp.exclusionPolicy to checkFilesAndFolders.

alanpawlak commented 6 days ago

Thank you!

        "C_Cpp.exclusionPolicy": "checkFilesAndFolders",
        "C_Cpp.files.exclude": {
            "tracy/profiler/src/profiler/TracyMicroArchitecture.cpp": true,
            "**/.vscode": true,
            "**/.vs": true
        },

Worked and it seems to work fine now! Is this a known issue? What is the file limit for IntelliSense to process?

bobbrow commented 3 days ago

@sean-mcmanus, sqlite.c is bigger than this one and we are able to process it. Are you just saying that this file will slow down the parsing because it's big? I opened it by itself and the extension appeared to work. Could you clarify why it should be excluded?

sean-mcmanus commented 3 days ago

@bobbrow My reference to "too large" was a simplification -- it's an issue with too much of a particular type of modification to the database. Oleg said he was going to look at fixing it so that it would cancel/time out as it supposed to be doing. What do you mean by "extension appeared to work"? Are you saying you saw the database update? I was seeing it "stuck" on the database update.

bobbrow commented 3 days ago

@sean-mcmanus I may have been mistaken. I thought the database icon was gone, but I tried again and saw it get stuck. However, adding the following to cpp.hint and reloading the window got me a successful parse:

#define V static constexpr AsmVar
#define A static constexpr AsmVar const*
#define O static constexpr AsmOp
sean-mcmanus commented 3 days ago

Oh, cool, yeah, that's a better workaround than using the excludes.