将 Visual Studio Code 路径设置为 .clang_format 文件

Goo*_*mps 6 c++ clang-format visual-studio-code

如何告诉 vs code 在哪里查找 .clang_format 文件?我的这个文件所在的位置不是我的 vscode 项目的根目录。Clang_format_path 显然不是我需要的,因为它指定了 clang 可执行文件的路径:

C_Cpp: Clang_format_path clang-format 可执行文件的完整路径。如果未指定,并且 clang-format 在环境路径中可用,则使用该格式。如果在环境路径中找不到,则将使用与扩展捆绑在一起的 clang-format 副本

然后是 Clang_format_style。

C_Cpp:Clang_format_style编码风格,目前支持:Visual Studio、LLVM、Google、Chromium、Mozilla、WebKit。使用“file”从当前目录或父目录中的 .clang 格式文件加载样式。使用 {key: value, ...} 设置具体参数。例如,“Visual Studio”样式类似于: { BasedOnStyle: LLVM, UseTab: Never, IndentWidth: 4, TabWidth: 4, BreakBeforeBraces: Allman, AllowShortIfStatementsOnASingleLine: false, IndentCaseLabels: false, ColumnLimit: 0, AccessModifierOffset: -4 }

我可以将其设置为文件,但如何指定在哪里查找该文件?

que*_*ent 4

不幸的是,目前看来这是不可能的。该扩展仅在项目目录中查找 .clang-format 文件。