语句中间的 `ifdef` 关键字未在 vscode 中突出显示

`ifdef` keyword in middle of a statement is not highlighted in vscode

语句中间的 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
  {
  }
};