Closed BigBahss closed 3 years ago
Fixed on branch move-definition
.
I found an issue regarding namespace scope declarations. Consider this code:
namespace foo {
void foo() {}
}
When I run the command "Add declaration", this is what my header file looks like:
void foo::foo();
This is illegal in C++, the correct code would be:
namespace foo {
void foo();
}
I think this issue should be reopened.
Currently, 'Move Definition' is basically a copy-and-paste after smart-placement is determined. It does not account for changes in scope at the target position. For instance, if the definition exists within a namespace block, and the target position is not within that same namespace, the definition will be lacking scope-resolution. For instance:
If bar is moved to a position that is not within
namespace foo
, the definition should become:This is something I did not account for when I created the command, and it is being worked on. This will probably be fixed in the next feature release which will add moving a definition into/out of a class body (which also needs to account for the same thing, but with the class name).