-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Description
Environment
- OS and Version: Windows_NT x64 10.0.26200
- VS Code Version: 1.107.1
- C/C++ Extension Version: 1.29.3
Bug Summary and Steps to Reproduce
Bug Summary:
When renaming macro definition symbols (by pressing F2), I noticed that the behavior of renaming is inconsistent, depending on the relative position of the macro definition and the #include directive:
-
When the macro definition appears after the
#includedirective:
The usage of the macro is renamed, but the macro definition itself is not renamed. -
When the macro definition appears before the
#includedirective:
Both the macro definition and its usage are renamed correctly.
Steps to reproduce:
- Create a C/C++ file, e.g., test.c.
- Define a macro after the
#includedirective, for example:
#include <stdio.h>
#define TEST 1
int main() {
printf("%d\n", TEST);
}-
Try renaming TEST using F2.
-
Observe the result: The macro usage (the
printfline) is renamed, but the macro definition (the#defineline) remains unchanged. -
Swap the order of the macro definition and the
#includedirective, repeat step 3, and observe whether both are renamed.
Expected behavior:
Regardless of the relative position of the macro definition and the #include directive, renaming a macro should rename both the macro definition and all its usages.
Configuration and Logs
Only the compiler path has been added, and other configurations remain at their default values:
{
"C_Cpp.default.compilerPath": "c:\\ProgramFiles\\ArmGun\\bin\\arm-none-eabi-gcc.exe"
}Other Extensions
No response
Additional context
No response
Metadata
Metadata
Assignees
Labels
Type
Projects
Status