Find All References doesn't find references in preprocessor statements (also affects Rename Symbols)
#define DEF1 1
#define DEF2 DEF1
#ifdef DEF1
int main(){
return DEF1;
}
#endif
Bug: Find All References only finds the "return DEF1;" and not the cases in the #define/#ifdef. VS handles that case correctly.
It also affects rename (which uses find all references).
As I don't have access to VS atm, can You maybe tell me what would be the case with the following code, if I want to see all references to myVariable?
#define DEF1 myVariable
#define DEF2 DEF1
int main(){
return DEF1 + DEF2;
}
VS Code won't find any references for myVariable at the moment, will this change with this issue in the future too?
The fix for this bug would only find the line "#define DEF1 myVariable" and not the uses of the macro DEF1.
Is there any plan for this issue to be fixed?
Yes, eventually -- it should be fixed after we've unified the VS and VS Code more. From what I recall, there was a component missing for handling this case correctly, but it's possible I'm remembering incorrectly and could double-check later (might take a while since I have higher priority failures to investigate).
Renaming a C/C++ macro is a much needed feature in any C/C++ IDE. Added my upvote, hopefully VSCODE will have it soon.
Is there any hope of fixing this BUG?
Is there any workaround to find variables that are mentioned in a preprocessor directive in visual studio code?
One year has passed, and I'm still looking for a solution to this problem. However, I'm very frustrated because the problem still exists. 😥
6 years passed since this issue was originally created. Looking at the history it seems that the developer that created this issue (@sean-mcmanus ) unassigned himself from the issue. Later, automation moved the issue to triage, aftter which @bobbrow removed it from triage and has remained with no status since 20 jun 2024.
Could we get a status update so we at least know if this ever has a chance of being fixed?
Some areas of work make (or even require) heavy use of macro aliasing (like AUTOSAR). If Microsoft wants to attract more commercial customers towards VSCode, issues like this really need to be addressed (since correct symbol navigation inside an IDE is a core feature).