Header file with duplicate name but unique directory not identified by intellisense
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 48/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Quiet
- Tech stack
- cpp, vscode
- Domain
- developer-experience, devtools
Research direction
Reproduce the reported layout with duplicate Resources/common.h files in separate projects, then inspect the extension's IntelliSense diagnostics and debug logs while comparing ProjectA/SourceA.cpp with ProjectB/SourceB.cpp. Trace how the extension identifies and indexes headers when go-to-definition succeeds but identifiers remain unresolved. Done means both project-local headers are indexed and references resolve without red squiggles.
Written by the indexing model from the issue text.
Description
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)
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 1d 4h
- Merged PRs (30d)
- 60
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from microsoft/vscode-cpptools
-
more info needed
microsoft/vscode-cpptools#14793 · 1 comment · 1 assignee ·
-
more info needed
Difficulty 4/5 3-5 days Newbie friendliness 35/100
microsoft/vscode-cpptools#14787 · 1 comment · 1 assignee ·
-
[Bug] cpptools fails to start on Ubuntu ARM64 due to missing execute permissions on shared libraries Openbug fixed Language Service regression
microsoft/vscode-cpptools#14779 · 1 comment · 1 assignee ·
-
Language Service more info needed
microsoft/vscode-cpptools#14778 · 1 comment · 1 assignee ·
-
Feature Request Language Service parser
Difficulty 4/5 3-5 days Newbie friendliness 64/100
microsoft/vscode-cpptools#14769 · 1 comment ·
All issues in microsoft/vscode-cpptools
Similar issues
-
blocklist removal
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
MetaMask/eth-phishing-detect#296544 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
pastelsky/bundlephobia#1122 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
category/development priority/P2 scope/file-operations scope/testing type/enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
-
Enatega Customer and Rider app: Add-ons price is not visible to customer after order is placed. Open
Difficulty 2/5 1-3 hours Newbie friendliness 75/100