Can clang-format be instructed to maintain newlines in a function call parameter list?

Viewed 50

For example, in Go, the following is a correctly go-fmt'ed code

func main() {
    fmt.Println("Hello World",
        "some",
        "more", "args", "s",
        "Bye World")
}

I am able to have groups of parameters share a line and go-fmt will not second-guess me. This is IMO sensible when some parameters are related to each other and I can express that by having them share a line in the call.

On the other hand, clang-format insists either on bin-packing the parameter list, or placing every parameter on its own line, with no middle ground.

    Println("Hello World", "some", "more", "args", "s", "Bye World")

or

    Println("Hello World",
            "some",
            "more",
            "args",
            "s",
            "Bye World")

Is this how it is, or can clang-format be instructed to behave the go-fmt way in regards to these "preformatted" parameter lists?

My question is quite similar to stop clang format from breaking lines, except I believe I am expressing the specific goal here: preserve line breaks in the original parameter list (as long as it does not conflict with line length limits, etc).

0 Answers
Related