can clang-formatter add an option of SortIncludes?

Post here any ideas/problems/suggestions you have regarding CodeLite's CodeFormatter (AStyle) plugin
xiaomajia52
CodeLite Curious
Posts: 1
Joined: Thu Feb 17, 2022 9:39 am
Genuine User: Yes
IDE Question: C++
Contact:

can clang-formatter add an option of SortIncludes?

Post 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

User avatar
eranif
CodeLite Plugin
Posts: 6375
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: can clang-formatter add an option of SortIncludes?

Post 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
Make sure you have read the HOW TO POST thread
User avatar
Jarod42
CodeLite Expert
Posts: 240
Joined: Wed Sep 30, 2009 5:54 pm
Genuine User: Yes
IDE Question: C++
Location: France
Contact:

Re: can clang-formatter add an option of SortIncludes?

Post by Jarod42 »

Normally, you can separate group of headers with space (extra line),
so each group is sorted alphabetically.

Post Reply