aheze / Multiliner

An Xcode source extension to expand lengthy lines.
https://twitter.com/aheze0/status/1541578738239885312
MIT License
827 stars 23 forks source link

Suggestion: add option for first parameter to be on same line #18

Open orchetect opened 2 years ago

orchetect commented 2 years ago

While I am actually a fan of Multiliner's current formatting behavior, some people might prefer not having a line-break between the method name and the first parameter.

Current Behavior

func sendAppStatus(
    to toNodes: [Node],
    name: String?,
    bundleID: String,
    state: Int32,
    isDockApp: Bool
) {
    // ...
}

Proposed opt-in behavior (as a preference)

First parameter starts on the same line, and closing parens trails immediately after the last parameter.

func sendAppStatus(to toNodes: [Node],
                   name: String?,
                   bundleID: String,
                   state: Int32,
                   isDockApp: Bool) {
    // ...
}
aheze commented 2 years ago

EWWWWWWWWWWWWWWWW

aheze commented 2 years ago

But sure, I'll add a preference. Need to figure out how to share data between the main app and the extension though...

orchetect commented 2 years ago

I hate it too, just looking out for others 😎

orchetect commented 2 years ago

I can foresee some other options being added in future so wouldn't be a bad idea to figure it out. And another reason why unit tests will become increasingly useful if more options get added.

vitalyverkash commented 2 years ago

Just wanted to create the same suggestion but it already exists. Only one clarification - not only the first parameter shouldn't be on a separate line, but also the closing round bracket.

With the current implementation we will get this formatting:

ClickableCard(
    image: "",
    title: "",
    value: "",
    action: { }
)

My proposition to have an option for this:

ClickableCard(image: "",
              title: "",
              value: "",
              action: { })
orchetect commented 2 years ago

My proposition to have an option for this:


ClickableCard(image: "",
              title: "",
              value: "",
              action: { })

That's what my example already shows but I can amend the request wording to be explicit.