Using clang-format with C++/CLI “for each”

試著忘記壹切 提交于 2020-01-05 05:45:06

问题


I currently try to format C++/CLI code using clang-format (version 9.0.0). I cannot figure how to handle for each statements.

Before:

for each (auto i in I)
{
}

After (say, CTRL-K/CTRL-D in Visual Studio):

for
   each (auto i in I)
   {
   }

I read here this:

...you might want to change ForEachMacros to add "for each"

I tried this:

ForEachMacros:
  - for each
  - foreach
  - Q_FOREACH
  - BOOST_FOREACH

then this:

ForEachMacros:
  - 'for each'

and this:

  - "for each"

and even this:

  - "for\s+each"

Nothing works. Is there a way to make it works? In the doc, it is written that it (ForEachMacros) is a vector of macros... so I don't see how a can create a macro with a space character inside!

Can someone help me with this problem?

Thanks!

来源:https://stackoverflow.com/questions/58995706/using-clang-format-with-c-cli-for-each

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!