given
// bar.h
namespace Foo
{
struct Bar {}
}
// bar.cpp
Bar b;
The refactor menu for Bar (in bar.cpp) offers to "include bar.h". This usually works well.
However, it does not help with adding the required namespace.
The following suggestions would be nice:
- add "Foo::" to the declaration (resulting in Foo::Bar b;)
- add "using namespace Foo" to current scope, current function or current file
- add "using Foo::Bar" to one of these scopes
Thinking about it, there are pretty many options how to resolve this, I'm not quite sure how to present them, maybe "add to current scope" is not that very and could be omitted.
Of course, "using namespace..." should not be suggested in a header file, and "add to current scope" can be omitted if the current scope is the function (or file).