2

我们的项目中有很多 c++ 代码库,通常它们的结构如下:

some_sw_repo/
    |
    |-- tools/ (sub-module, common to all projects)
          |
          |-- .clang-format

我在文件夹级别运行 clang-format some_sw_repo/,但我看不到任何方法告诉 clang-format 该.clang-format文件位于tools/子文件夹中。所以目前我正在复制格式文件,然后运行 ​​clang-format 然后再次删除它(因为我不想要本地副本 - 我们想要所有项目的副本)。

这没关系,因为我可以添加一个制作配方来做到这一点。但是还有一个非常方便的 vs-code 插件:https ://marketplace.visualstudio.com/items?itemName=xaver.clang-format

哪个效果很好……如果 .clang-format 文件位于顶层。

有没有办法告诉 clang-format .clang-format 文件位于特定位置?

我的 clang-format 版本是 v10.0.0

4

0 回答 0