I'm trying to format classes inside namespaces in the following way (BreakBeforeBraces: Allman
):
namespace test_a::test_b
{
struct A
{
int a;
int b;
};
} // namespace test_a::test_b
but clang format keeps changing it to
namespace test_a::test_b
{
struct A
{
int a;
int b;
};
} // namespace test_a::test_b
The workaround in this question works only with configurations like BasedOnStyle: Google
no brakes before opening braces for example
namespace test_a::test_b {
struct A {
int a;
int b;
};
} // namespace test_a::test_b
Same for this answer
I want clang-format to always add an empty line after namespace opening brace and before closing brace, is that possible?
For clarity, this is the clang-format I use
---
BasedOnStyle: Google
AccessModifierOffset: -4
AlignConsecutiveDeclarations: 'true'
BinPackArguments: 'false'
BinPackParameters: 'false'
IndentWidth: '4'
AlignConsecutiveAssignments: 'true'
ColumnLimit: 120
BreakBeforeBraces: Allman
AllowShortIfStatementsOnASingleLine: false
...