vscode-cpptools
vscode-cpptools copied to clipboard
Extend 'Rename Symbol' feature to support renaming macros
Type: LanguageService
Describe the bug
- OS and Version: Windows 10
- VS Code Version: 1.49.1
- C/C++ Extension Version: v1.01
- Other extensions you installed (and if the issue persists after disabling them): PlatformIO, Does persist.
- Does this issue involve using SSH remote to run the extension on a remote machine?: No
Project size is irrelevant, happens also in one file as seen below.
Steps to reproduce
#define TEST_CONSTANT "string"
void main() {
std::cout << TEST_CONSTANT;
}
- Try to rename the TEST_CONSTANT using F2 (Rename Symbol).
- Notice it only renames usages, but not the define itself.
Expected behavior
It should also rename the constant itself.
This feature is currently specific to semantic symbols. For example, if you have functions named foo() in multiple classes, and select just one class's instance of foo(), it should not rename foo() in unrelated classes. I don't believe it's intended to perform the equivalent of a Replace All, which can be done using the Search pane. We can consider this a request to extend the feature to macro names, if possible. We may be able to ensure that only sources leveraging the same #define statement (and not another unrelated #define of the same name) are modified.
We may be able to ensure that only sources leveraging the same #define statement (and not another unrelated #define of the same name) are modified.
What do you mean unrelated defines? Defines are global and should be unique.
Right now the behavior is very surprising.
Still not fixed :/
v1.73 fails to rename simple thing as
main.c