Код: Выделить всё
IncludeBlocks: Regroup
SortIncludes: CaseInsensitive
< /code>
Я хочу сортировать включение, но я не хочу включать в стандартные или 3-й стороны заголовков (#include Код: Выделить всё
#include ""и.e. Вывод должен быть похож на следующее: < /p>
Код: Выделить всё
#include
#include
#include
#include
#include "another_local_header.h"
#include "local_header.h"
< /code>
Как я могу указать это в .clang-format? Будет ли здесь includecategories Код: Выделить всё
IncludeCategories:
- Regex: '\"project\/libMyComp\/public(\/\w+)*\/*.h\"'
Priority: 1
SortPriority: 1
- Regex: '\"project\/libMyComp\/private(\/\w+)*\/*.h\"'
Priority: 2
SortPriority: 2
- Regex: '\"project\/lib\w+\/(public|private)(\/\w+)*\/*.h\"'
Priority: 3
SortPriority: 3
- Regex: '\"(\w+\/)*\w+\.h[h|p]*\"'
Priority: 4
SortPriority: 4
- Regex: ''
Priority: 5
SortPriority: 5
- Regex: ''
Priority: 6
SortPriority: 6
IncludeBlocks: Regroup
Код: Выделить всё
#include "project/libMyComp/public/MyClass.h"
#include "project/libMyComp/private/MyInternalClass.h"
#include "project/libOtherComp/public/OtherClass.h"
#include "project/libAnotherComp/public/AnotherClass.h"
#include "SomeUtil.hh"
#include
// Maybe this space removal is ok
#include
#include
#include
< /code>
Однако то, что я получил, похоже на следующее: < /p>
#include "project/libAnotherComp/public/AnotherClass.h"
#include "project/libMyComp/private/MyInternalClass.h"
#include "project/libMyComp/public/MyClass.h"
#include "project/libOtherComp/public/OtherClass.h"
#include "SomeUtil.hh"
#include
#include
#include
#include
Подробнее здесь: https://stackoverflow.com/questions/794 ... nor-groups
Мобильная версия