How to correctly disable include sorting by clang-format?

Viewed 302

This question and answers clang format: disable ordering includes, indicate that the way to disable sorting of includes by clang-format is to set the following. This works as one may expect.

SortIncludes: false

However, the documentation (https://clang.llvm.org/docs/ClangFormatStyleOptions.html) indicates that it should be the following since clang-format 4.

SortIncludes: Never

But clang-format (v 10.0.0-4ubuntu1) does not grok this

$ clang-format -i ./foo.c
YAML:40:15: error: invalid boolean
SortIncludes: Never
              ^~~~~
Error reading ./.clang-format: Invalid argument

Is this a bug in the documentation, or have I misunderstood what the docs are saying?

1 Answers

The version refers only to when the option was added. I had the same error and found out that arguments have changed since version 13.0. Unfortunately, there is no documentation of changes of the arguments between versions.

From clang-format version 4.0 up to 12.0

SortIncludes: {true|false}

Since version 13.0

SortIncludes: {Never|CaseSensitive|CaseInsensitive}
Related