Page 1 of 1
can clang-formatter add an option of SortIncludes?
Posted: Thu Feb 17, 2022 9:47 am
by xiaomajia52
when i coding windows program,the auto sort will sort the headers like this
#include <comdlg32.h>//1
#include <windows.h>//2
this is wrong because the windows.h must be put at first,comdlg32 require some define in windows.h.
and now ,i export a .clang-format file and put SortIncludes: false in this file,
i hope this feature can be chosed in the list
Re: can clang-formatter add an option of SortIncludes?
Posted: Sat Feb 19, 2022 7:55 pm
by eranif
if you dont want clang-format to sort things for you, wrap your code with
Code: Select all
// clang-format off
..
// clang-format on
Re: can clang-formatter add an option of SortIncludes?
Posted: Mon Feb 21, 2022 1:26 pm
by Jarod42
Normally, you can separate group of headers with space (extra line),
so each group is sorted alphabetically.