-
Notifications
You must be signed in to change notification settings - Fork 15.4k
Open
Labels
Description
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 20.04.3 LTS
Release: 20.04
Codename: focal
$ clang-format-12 --version
Ubuntu clang-format version 12.0.0-3ubuntu1~20.04.4
.clang-format:
IndentWidth: 4
TabWidth: 4
UseTab: ForContinuationAndIndentationObserved indentation:
struct Foo {
→ Foo &long_named_self_returning_method();
};
int main() {
→ auto foo = Foo{}
→ → → → ···.long_named_self_returning_method()
→ → → → ···.long_named_self_returning_method()
→ → → → ···.long_named_self_returning_method()
→ → → → ···.long_named_self_returning_method();
}
Specifically, it looks like continuation lines are indented +4 relative to the expression start Foo{}.
Desired indentation:
struct Foo {
→ Foo &long_named_self_returning_method();
};
int main() {
→ auto foo = Foo{}
→ → .long_named_self_returning_method()
→ → .long_named_self_returning_method()
→ → .long_named_self_returning_method()
→ → .long_named_self_returning_method();
}
i.e. indent continuation lines relative to the start of preceding line.
I especially consider it a bug to emit the sequence <tab><space>. It will break every reader who uses a different tab width.
seijikun, zhiayang, bjwrk, sh-at-cs, NekkoDroid and 16 more