Skip to content

Header file with duplicate name but unique directory not identified by intellisense #14539

Description

@BeckBusch

Bug Summary

I am using VSCode to work on source files from a large Visual Studio solution with many projects. Each project has its its own directory with various source files, and a subfolder for resource headers.

Solution/
├─ ProjectA/
│ ├─ Resources/
│ │ ├─ common.h
│ ├─ SourceA.cpp
├─ ProjectB/
│ ├─ Resources/
│ │ ├─ common.h
│ ├─ SourceB.cpp

ProjectA/Resources/common.h will only ever be referenced by source files within the ProjectA directory.
The issue with this is each of these resource headers has the same filename, so the intellisense database will only process the first one it finds. This is usually the first project folder alphabetically.
When running intellisense, on the above example, references to ProjectA/Resources/common.h by ProjectA/SourceA.cpp are resolved.
References to ProjectB/Resources/common.h by ProjectB/SourceB.cpp are not resolved and result in red squiggles with "identifier XYZ is undefined"

However when I click on the identifier in Source.B and select "go to definition" the extension correctly opens ProjectB/Resources/common.h and jumps to the selected identifier.

Configuration and Logs

This behavior is found in the default configurations. I have not been able to find a change to the configuration that alters this behavior.

Debug log diagnostics do not display anything unusual or useful.

Environment

  • OS and Version: Win 11 25H2
  • VS Code Version: 1.125.1 (issue identified on earlier versions)
  • C/C++ Extension Version: 1.33.0 (issue identified on earlier versions)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status
    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions