3

I'm trying to use a clang-format file in CLion but CLion gives me the error: Error reading [path to clang-format]: Invalid Argument

The error has to do with the RawStringFormats in my .clang-format file. When I remove the RawStringFormats section, CLion gives me no errors.

My .clang-format file is auto-generated by a script using Google's standards.

I need to find out the cause of the problem so I can modify the script to prevent this issue.

RawStringFormats: 
  - Delimiter:       pb
    Language:        TextProto
    BasedOnStyle:    google
2
  • 1
    you probably generated the format file with an old version of clang-format. Newer versions have slightly different RawStringFormats paremeters. Therefore, make sure both versions (your generating and the editors one) are matching Mar 25, 2020 at 11:35
  • Maybe there is a quicker way but I used echo "" | clang-format --dry-run to validate the file May 31, 2020 at 10:49

1 Answer 1

6

Delimiters is an array parameter, so

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

CLion has a schema validator, and pb in your example is highlighted by yellow in editor. The tooltip shows the message:

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

CLion validator message

1
  • 5
    I just want to add that it's not only pb -> [pb] but also the key is pluralized Delimiter -> Delimiters. May 31, 2020 at 10:51

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.