Page MenuHomePhabricator

[clang-format] C# does not indent braced initializers as continuations
ClosedPublic

Authored by jbcoe on Mar 6 2020, 3:58 AM.

Details

Summary

C# treats object initializers as braced init blocks. Braced init blocks are no longer indented as continuations.

Diff Detail

Event Timeline

jbcoe created this revision.Mar 6 2020, 3:58 AM
Herald added a project: Restricted Project. · View Herald TranscriptMar 6 2020, 3:58 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
jbcoe updated this revision to Diff 248712.Mar 6 2020, 5:54 AM
jbcoe updated this revision to Diff 248719.Mar 6 2020, 6:39 AM

Remove comma to tidy up ugly format test and actually test what is needed.

krasimir requested changes to this revision.Mar 9 2020, 9:47 AM
krasimir added inline comments.
clang/unittests/Format/FormatTestCSharp.cpp
544

Please add test cases that demonstrate the +2 indent used when breaking inside C# object initializers.

This revision now requires changes to proceed.Mar 9 2020, 9:47 AM
krasimir added inline comments.Mar 9 2020, 9:57 AM
clang/unittests/Format/FormatTestCSharp.cpp
544

Consider also adding an example with a trailing comma if the behavior there can be different than the one without a trailing comma.

jbcoe marked 2 inline comments as done.Mar 9 2020, 10:14 AM
jbcoe added inline comments.
clang/unittests/Format/FormatTestCSharp.cpp
544

The test at L 529 already covers 2 space indent and a trailing comma.

krasimir accepted this revision.Mar 9 2020, 10:18 AM

Thank you

This revision is now accepted and ready to land.Mar 9 2020, 10:18 AM
This revision was automatically updated to reflect the committed changes.