aheze / Multiliner

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

Closing parens of function returning a closure put onto wrong line #14

Open DivineDominion opened 2 years ago

DivineDominion commented 2 years ago

Played around with Multiliner a bit :)

Given this input:

func applyContentActions(action: AppAction, reducers: [TableActionReducer]) -> (_ documentState: DocumentState) -> DocumentState {
    ...
}

I expected somewhat along these lines::

func applyContentActions(
    action: AppAction,
    reducers: [TableActionReducer]
) -> (_ documentState: DocumentState) -> DocumentState {
    ...
}

Actual output did try to put the parens and the arrow onto a new line, but not the first occurrence:

func applyContentActions(
    action: AppAction,
    reducers: [TableActionReducer]) -> (_ documentState: DocumentState
) -> DocumentState {
    ...
}
aheze commented 2 years ago

Yeah, the formatting script is kind of dumb right now, it just checks for the first and last occurrence of the parentheses and splits the content within that. Something smarter would help #3 too