nicklockwood / SwiftFormat

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

auto-format `something??""` to `something ?? ""` #1483

Closed mesqueeb closed 1 year ago

mesqueeb commented 1 year ago

I'd love support for auto-formating something??"" to something ?? ""

nicklockwood commented 1 year ago

@mesqueeb I didn't actually realize this didn't work already!

It looks like it's a bug due to special casing to avoid adding spaces around chained unwrap operators like foo??.bar()

Edit: wait - it looks like something??"" isn't valid code - it doesn't compile. In general I only try to reformat valid Swift.