如何解决vscode中未突出显示语句中间的`ifdef`关键字
在语句ifdef
中,语句中间的vscode
关键字未突出显示为粉红色,而在开头的关键字则突出显示为粉红色。为什么会发生这种情况?
class TestClass {
int m_x;
#ifdef FLAG // This ifdef keyword is highlighted
int m_variable_used_when_flag_enabled;
#endif
TestClass(int x) : m_x(x)
#ifdef FLAG // This ifdef keyword is NOT highlighted,m_variable_used_when_flag_enabled()
#endif
{
}
};
解决方法
在Xcode和Sublime Text上看起来不错。因此,这是编辑者的限制,您可以在VSCode的GitHub存储库中提交错误。
此外,请注意,逗号应位于条件中,而不应在其外部。会导致编译错误。
class TestClass {
int m_x;
#ifdef FLAG // This ifdef keyword is highlighted
int m_variable_used_when_flag_enabled;
#endif
TestClass(int x)
: m_x(x)
#ifdef FLAG // This ifdef keyword is NOT highlighted,m_variable_used_when_flag_enabled()
#endif
{
}
};
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。