microsoft / microsoft/vscode-cpptools

C/C++ not scan my code folder (workspace)

Open
#12,784 17 comments 0 reactions 1 assignee View on GitHub

@sean-mcmanus is already working on this.

Since Nov 18, 2024.

bug investigate: repro Language Service
Dominant language
TypeScript
Stars
6.2k
Forks
1.7k
Avg merge
14h 46m
Merged PRs (30d)
61

Description

Environment
  • OS and Version: Windows 10 Enterprise 22H2
  • VS Code Version: 1.93.1
  • C/C++ Extension Version: v1.22.6 (pre-release)
  • If using SSH remote, specify OS of remote machine
Bug Summary and Steps to Reproduce

When I use "Go To Definition" in *.c, it always jump to .h, not the function code in *.c. After debug, I found the root cause is C/C++ not scan my code folder, only scan the current opened *.c file and all its including *.h files, here is the log for cpptools/resetDatabase

LSP: (received) cpptools/resetDatabase
LSP: (invoked) cpptools/resetDatabase
Creating/updating compiler cache data tables (previously: 0)
Code browsing service initialized
Discovering files...
Populating file name cache...
Done populating filename cache. Elapsed time: 0 ms
Processing folder (recursive): C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.19041.0\SHARED
Processing folder (recursive): C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.19041.0\UM
Processing folder (recursive): C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.19041.0\CPPWINRT
Processing folder (recursive): C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.19041.0\UCRT
Processing folder (recursive): C:\PROGRAM FILES (X86)\WINDOWS KITS\10\INCLUDE\10.0.19041.0\WINRT
Processing folder (non-recursive): C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\ENTERPRISE\VC\TOOLS\MSVC\14.29.30133\ATLMFC\INCLUDE
Processing folder (non-recursive): C:\PROGRAM FILES (X86)\MICROSOFT VISUAL STUDIO\2019\ENTERPRISE\VC\TOOLS\MSVC\14.29.30133\INCLUDE
Discovering files: 4871 file(s) processed
0 file(s) removed from database
Done discovering files.
Populating include completion cache.
Parsing remaining files...
Parsing: 0 files(s) processed
Done parsing remaining files.
Database safe to open.

Actually I have a code workspace like this:
image

  1. It has nothing to do with the .vscode/c_cpp_properties.json because I tried to delete it.
  2. It has nothing to do with the Remote SSH because I tried locally, still error.
  3. A newly installed Windows 10 OS in virtual machine and newly installed VS Code, only install C/C++, without login any account.

So it only related to my Windows 10 OS. I have used VS Code for years, both local dev. and ssh dev., so it's so wired to see this issue...

Configuration and Logs
-------- Diagnostics - 9/30/2024, 2:39:01 PM
Version: 1.22.6
Current Configuration:
{
    "name": "Win32",
    "includePath": [
        "d:/BHS-BIOS/**"
    ],
    "defines": [
        "_DEBUG",
        "UNICODE",
        "_UNICODE",
        "MAX_SOCKET"
    ],
    "forcedInclude": [
        "MdePkg/Include/X64/ProcessorBind.h",
        "MdePkg/Include/Base.h",
        "MdePkg/Include/Uefi.h"
    ],
    "compilerPathIsExplicit": false,
    "cStandardIsExplicit": false,
    "cppStandardIsExplicit": false,
    "intelliSenseModeIsExplicit": false,
    "macFrameworkPath": [],
    "windowsSdkVersion": "10.0.19041.0",
    "cStandard": "c17",
    "cppStandard": "c++17",
    "intelliSenseMode": "windows-msvc-x64",
    "mergeConfigurations": false,
    "compilerPath": "C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Enterprise\\VC\\Tools\\MSVC\\14.29.30133\\bin\\Hostx64\\x64\\cl.exe",
    "browse": {
        "path": [
            "d:/BHS-BIOS/**",
            "${workspaceFolder}"
        ],
        "limitSymbolsToIncludedHeaders": true
    }
}
Modified Settings:
{
    "C_Cpp.loggingLevel": "Debug"
}
Additional Tracked Settings:
{

}
cpptools version (native): 1.22.6.0
Current database path: C:\USERS\ADMINISTRATOR\APPDATA\LOCAL\MICROSOFT\VSCODE-CPPTOOLS\245AD5896190AFBE2AD35ECEDAFB20F9\.BROWSE.VC.DB
No active translation units.

------- Workspace parsing diagnostics -------
Number of files discovered (not excluded): 4871
Other Extensions

nothing

Additional context

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.