aheze / Multiliner

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

Improvement: Apply correct formatting on code with multiple lines #6

Closed jdev7 closed 2 years ago

jdev7 commented 2 years ago

While it works perfectly on a one line function, if you already have code like this:

func foobar(_ foo: Foo,
                       bar: Bar)

and you apply multiliner, the result will be:

func foobar(
        _ foo: Foo,

                       bar: Bar
    )

which is not great. It would be awesome if it already detected new lines, and didn't apply new indentation. For the latter I don't know if it could re-use Xcode's reindent command for each line maybe, so you don't have to implement it yourself.

aheze commented 2 years ago

Hmm, I think I can fix this by stripping newlines before piecing it back together. I'll get back to this tomorrow, thanks for the suggestion!

aheze commented 2 years ago

@jdev7 fixed in 1.1! https://github.com/aheze/Multiliner/releases/tag/1.1.0

jdev7 commented 2 years ago

Works perfect! Thanks :)