[clang-format] feature request: add a DSL, to control clang-format from source.
Instead of completely disabling Clang-Format it might be useful, to disable specific options, or change a style temporarily. It would also allow for better, fine-grained formattings.
Imagine the case, where you have 2 main headers for one source file:
Then currently, only the first is detected as main include. It would be useful to have something like
// clang-format pragma: main_include
Which changes the following:
#include "a.h"
#include "b.h"
#include "a_test.h"
automatically into this:
#include "a.h"
#include "a_test.h" // clang-format pragma: main_include
#include "b.h"
Or the opposite:
#include "no/main/include/a.h"
#include "a.h"
#include "b.h"
with // clang-format pragma: no_main_include into this:
#include "a.h"
#include "b.h"
#include "no/main/include/a.h" // clang-format pragma: no_main_include
In the best case, all possible options are covered somehow.
@llvm/issue-subscribers-clang-format
Interesting issue. I also would like to see this feature request implemented.