llvm / llvm/llvm-project

[clang-format] Feature request: do not remove line breaks in function arguments declaration

Open
#167,204 1 comment 0 reactions 0 assignees View on GitHub
clang-format
Dominant language
LLVM
Stars
40.5k
Forks
18.7k
PR merge metrics
PR metrics pending

Description

This is vaguely related to #50393.

I would like to have an option (I guess it could be a new value in `BinPackArguments` and `BinPackParameters`), that would respect the existing line breaks, and only add new line breaks if the column limit is exceeded. Example:

```
// unformatted code
set_properties(object,
"name", name,
"age", 20);

// desired formatting
set_properties(object,
"name", name,
"age", 20);
```

Same in function declarations:
```
// unformatted code
void my_function_with_a_long_name_but_please_keep_the_line_breaks(int arg1, int arg2, int arg3,
int arg4, int arg5,
int arg6, int arg7)
{ ....

// desired formatting
void my_function_with_a_long_name_but_please_keep_the_line_breaks(
int arg1, int arg2, int arg3,
int arg4, int arg5,
int arg6, int arg7)
{ ....
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.