microsoft / microsoft/vscode-cpptools
Add missing include should prioritize the header with the class definition over headers with only a forward declaration (VS:1906590)
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Set up a project thusly:
Header.h
class Foo; // just forward declaration
Header2.h
class Foo {}; // the definition
Source.cpp
Foo foo;
Actual:
In the current product, Foo in cpp file should squiggle with "undefined" error and hovering over it offers both headers as suggestions.
Expected:
The suggested includes should be only Header2.h (to bring the full definition)
This should be addressed in VS and VS Code
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.
Research direction
Reproduce the case with Header.h, Header2.h, and Source.cpp, where Header.h only forward-declares Foo and Header2.h defines it. Verify the include suggestions produced for Source.cpp; done means only Header2.h is suggested, consistently in VS and VS Code.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100