HazardyKnusperkeks wrote:
> > While I absolutely share this sorting, it is already possible with the
> > regexes and the priorities without any doubt or confusion.
>
> @HazardyKnusperkeks I have tried to achieve this using regexes and priorities
> but could only go far due to the iterative nature of this sorting. This is
> what we have, which fails to replicate the desired logic:
>
> ```
> IncludeCategories:
> - Regex: '^[^/]*$'
> SortPriority: 0
> - Regex: '^[^/]*/[^/]*$'
> SortPriority: 1
> - Regex: '^[^/]*(/[^/]*){2}$'
> SortPriority: 2
> - Regex: '^[^/]*(/[^/]*){3}$'
> SortPriority: 3
> - Regex: '^[^/]*(/[^/]*){4}$'
> SortPriority: 4
> - Regex: '^[^/]*(/[^/]*){5}$'
> SortPriority: 5
> ```
>
> Is it possible for you to share your clang format settings? I would be so
> happy if this is really possible with the regexes and sort priorities
This is what I have for that priority:
```
- Regex: '^"\.\./\.\./.*'
Priority: 10
SortPriority: 14
CaseSensitive: false
- Regex: '^"\.\./[^/]+/.*'
Priority: 10
SortPriority: 13
CaseSensitive: false
- Regex: '^"\.\./.*'
Priority: 10
SortPriority: 12
CaseSensitive: false
- Regex: '^".*/'
Priority: 10
SortPriority: 11
CaseSensitive: false
- Regex: '^".*'
Priority: 10
SortPriority: 10
CaseSensitive: false
```
Yeah of course that is repetitive, depending on how many levels you want to
support. But on any given code base the levels are finite, you could even write
a small script to generate the needed configuration.
https://github.com/llvm/llvm-project/pull/208954
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits