You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Extend 'Rename Symbol' feature to support renaming macros #6194
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.
Reacted by programminghoch10, slaadvak, rasmusmk, James, Andreas Pareis, soapy-spacetime and Kevin Zhang
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.
It still can't work.
BTW, the macro in language C is NOT considered as a semantic symbol? The "Go To Definition" can support it, the Outline panel can support it as well.
To be honest, I'm not really understand the exact definition of the "semantic symbol" here..
I really don't get how such simple things can be broken for ages, while any IDE out there handles this properly from the start. (And no, "this is not an IDE, it's an editor, you are using it wrong" is not a catch-all excuse for things remaining half-broken. Other editors with C(++) support don't fail at this either.)
sorin0101 It was not "intentional" -- the find all references code was skipping macros for some reason, so when I change the code to stop skipping macros then rename works...I have to look into if there are any cases where there are problems with that change though. This should have been fixed 5 years ago (seems like it just fell through the cracks -- thanks for complaining it about it, otherwise we wouldn't have noticed).
Activity
Colengms commentedon Sep 23, 2020
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.
[-]Define directives don't get renamed correctly[/-][+]Extend 'Rename Symbol' feature to support renaming macros[/+]dzid26 commentedon Sep 17, 2022
What do you mean unrelated defines? Defines are global and should be unique. EDIT: they don't have to be though.
Right now the behavior is very surprising.
mrx23dot commentedon Jul 11, 2024
v1.73 fails to rename simple thing as

main.c
costyn commentedon Dec 14, 2024
Sad that this bug is still not fixed :( But at least I know I'm not doing it wrong.
xenkuo commentedon Dec 15, 2024
It still can't work.
BTW, the macro in language C is NOT considered as a semantic symbol? The "Go To Definition" can support it, the Outline panel can support it as well.
To be honest, I'm not really understand the exact definition of the "semantic symbol" here..
dzid26 commentedon Dec 15, 2024
It can be implemented the same as "Replace All". Just let user confirm with checkboxes which definitions they don't want to rename.
At this point, instead of making it perfect, just make it work :)
Unless you are bound by the language server limitations. Then let the sadness continue.
Dromantor commentedon Jan 16, 2025
I really don't get how such simple things can be broken for ages, while any IDE out there handles this properly from the start. (And no, "this is not an IDE, it's an editor, you are using it wrong" is not a catch-all excuse for things remaining half-broken. Other editors with C(++) support don't fail at this either.)
mrx23dot commentedon Jan 16, 2025
I agree, basic functions should have priority over new fancy features.
7 remaining items
sean-mcmanus commentedon Oct 28, 2025
sorin0101 It was not "intentional" -- the find all references code was skipping macros for some reason, so when I change the code to stop skipping macros then rename works...I have to look into if there are any cases where there are problems with that change though. This should have been fixed 5 years ago (seems like it just fell through the cracks -- thanks for complaining it about it, otherwise we wouldn't have noticed).
sean-mcmanus commentedon Nov 4, 2025
Fixed with https://github.com/microsoft/vscode-cpptools/releases/tag/v1.29.0 (pre-release)