首页 > 解决方案 > CLion 中 clang 格式的 RawStringFormats 错误

问题描述

我正在尝试clang-format在 CLion 中使用文件,但 CLion 给了我错误: Error reading [path to clang-format]: Invalid Argument

该错误与RawStringFormats我的.clang-format文件中的有关。当我删除该RawStringFormats部分时,CLion 没有给我任何错误。

我的.clang-format文件是由使用 Google 标准的脚本自动生成的。

我需要找出问题的原因,以便我可以修改脚本以防止出现此问题。

RawStringFormats: 
  - Delimiter:       pb
    Language:        TextProto
    BasedOnStyle:    google

标签: c++clionclang-format

解决方案


Delimiters是一个数组参数,所以

RawStringFormats:
  - Language: TextProto
    BasedOnStyle: Google
    Delimiters: [pb]

CLion有一个模式验证器,pb在您的示例中,在编辑器中以黄色突出显示。工具提示显示消息:

Schema validation: incompatible types
Required: array. Actual: String

CLion 验证器消息


推荐阅读