Search code examples
c++homebrewclang-format

Why does not my clang-format support PPDirectiveIndentStyle option?


Installed newest version clang-format on OSX:

$ brew upgrade clang-format
Error: clang-format 2018-04-24 already installed
$ clang-format -version
clang-format version 7.0.0 (tags/google/stable/2018-04-24)

And got one line in _clang-format file to format my C++ code:

PPDirectiveIndentStyle: AfterHash

which lead to error like this:

YAML:17:25: error: unknown key 'PPDirectiveIndentStyle'
PPDirectiveIndentStyle: AfterHash

I googled, got that this option is introduced at 2017.8 [Ref]. So it should be supported. How could I solve this problem?


Solution

  • Finally solved! The key should be IndentPPDirectives. Like these:

    IndentPPDirectives: AfterHash