Issue 123030
Summary Add break after assignment to format multiline expressions
Labels new issue
Assignees
Reporter Ren911
    

In our project we want an option to break after first assignment with multiline statements
For example, if _expression_ doesn’t fit on a single line, we add a break after assignment.

### Example 1 

```
anytype result = veerrrryyyyloooonnnnggggvaaarrriiiaabbblleeenameeee + seccconnnddverrryyyloooonnnggvarriaabbleeenammeeee + orjustalotofvariablesinvolvedinoneassignment;
```

The _expression_ above should become [like in this stackoverflow question](https://stackoverflow.com/questions/59235609/clang-format-multiline-variable-assignments)

```
anytype result = 
    veerrrryyyyloooonnnnggggvaaarrriiiaabbblleeenameeee +
    seccconnnddverrryyyloooonnnggvarriaabbleeenammeeee +
    orjustalotofvariablesinvolvedinoneassignment;
```

### Example 2

```
anytype result = some_long_function_with_arguments(arg1, arg2, arg3);
```
should become

```
anytype result = 
    some_long_function_with_arguments(arg1, arg2, arg3);
```

### What exists now in clang-format?

An option _AlwaysBreakBeforeMultilineStrings_  already exists in clang-format, and we want something similar, not only strings.

![Image](https://github.com/user-attachments/assets/6e5ae455-4d55-4b5c-ab38-f3b302a1b2a3)


_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to