[英]Visual Studio Code doesn't “Find all references” in #define and macros
Visual Studio Code doesn't see references in #defines or macros, but Visual Studio does. Visual Studio Code 在#defines 或宏中看不到引用,但 Visual Studio 可以。 Is there a setting that I don't see, that enables this?是否有我看不到的设置可以启用此功能?
[EDIT] To show that Visual Studio (IDE) does resolve the #define reference, I took another screenshot. [编辑] 为了显示 Visual Studio (IDE) 确实解析了 #define 引用,我拍摄了另一个屏幕截图。
Visual Studio Code (especially the C/C++ Extension) does a good job. Visual Studio Code(尤其是 C/C++ 扩展)做得很好。 Sometimes a reference cannot be resolved, in that case a restart or clearing/resetting the intellisense cache helps.有时无法解析引用,在这种情况下,重新启动或清除/重置智能感知缓存会有所帮助。 But it could be also a configuration error.但这也可能是配置错误。
In, File -> Preferences -> Settings在,文件 -> 首选项 -> 设置
Or或者
[CTRL] + [SHIFT] + P [CTRL] + [SHIFT] + P
Addendum附录
I realized it a little too late but like i mentioned it in my comment below, you have a misconception.我意识到这有点太晚了,但就像我在下面的评论中提到的那样,你有一个误解。
Analog to your problem:模拟您的问题:
char *FOO = "bar";
int bar = 1;
I don't think you expect the string literal "bar"
to be a reference to the variable int bar
?我不认为您希望字符串文字"bar"
是对变量int bar
的引用?
Well, in your case #define FOO bar
, bar
is just a literal and has no relation to the variable bar
in your main function.好吧,在你的情况下#define FOO bar
, bar
只是一个文字,与你的主 function 中的变量bar
没有关系。
I previously thought, that you have defined bar
somewhere else and Visual Studio Code couldn't resolve it, but that's not the case.我以前认为,您在其他地方定义了bar
并且 Visual Studio Code 无法解决它,但事实并非如此。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.