nicklockwood / SwiftFormat

A command-line tool and Xcode Extension for formatting Swift code
MIT License
7.62k stars 623 forks source link

[Bugs?] await keyword mistake order when I use Swift-testing library. #1707

Closed psbss closed 3 weeks ago

psbss commented 1 month ago

Hello

Apple's new testing library [swift-testing]() may include from Xcode16. So We started implementing of this library for our product but the format of await keyword order was mistake when I run swift-format command.

Examples

// original
#expect (await monitor.isAvailable == false)

// formatted (mistake)
#expect await (monitor.isAvailable == false)

Version: v0.53.8 installed This is our config:

# disable
--disable wrapMultilineStatementBraces
--disable preferKeyPath
--disable preferForLoop

# format options
--stripunusedargs closure-only
--self init-only
--commas inline
--extensionacl on-declarations
--wrapparameters before-first
--wraparguments before-first
--maxwidth 120
--guardelse next-line

# version
--swiftversion 5.9

Do we have a workaround?

nicklockwood commented 1 month ago

I suggest you use --disable hoistAwait for now

psbss commented 1 month ago

I see, thank you

nicklockwood commented 3 weeks ago

@psbss fixed in 0.54.0

psbss commented 3 weeks ago

Thank you so much @nicklockwood !!