Skip to content

clang-format: missing BraceWrapping configuration for multiline initialization list #81

Not planned
@alejandroclaro

Description

@alejandroclaro

It's not possible to adjust the position of braces when there is a multiple lines initialization list.

For example, in a code bases with Allman-like braces placement style. This

  std::vector<Bar> foo = 
  {
    makeBar(x, y, z),
    makeBar(u, v, w)
  };
  
  std::vector<int> baz = { 1, 2 };

is always transformed into this:

  std::vector<Bar> foo =  {
    makeBar(x, y, z),
    makeBar(u, v, w)
  };
  
  std::vector<int> baz = { 1, 2 };

It looks like there is a blocked PR related to this here: https://reviews.llvm.org/D91949

Activity

alejandroclaro

alejandroclaro commented on Apr 7, 2023

@alejandroclaro
Author

Sorry for this. I mistakenly reported the problem in the wrong repository

Junjie-Fan

Junjie-Fan commented on Jul 31, 2024

@Junjie-Fan

It's not possible to adjust the position of braces when there is a multiple lines initialization list.

For example, in a code bases with Allman-like braces placement style. This

  std::vector<Bar> foo = 
  {
    makeBar(x, y, z),
    makeBar(u, v, w)
  };
  
  std::vector<int> baz = { 1, 2 };

is always transformed into this:

  std::vector<Bar> foo =  {
    makeBar(x, y, z),
    makeBar(u, v, w)
  };
  
  std::vector<int> baz = { 1, 2 };

It looks like there is a blocked PR related to this here: https://reviews.llvm.org/D91949

does some format config can solve this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      No branches or pull requests

        Participants

        @alejandroclaro@Junjie-Fan

        Issue actions

          clang-format: missing BraceWrapping configuration for multiline initialization list · Issue #81 · angular/clang-format