nicklockwood / SwiftFormat

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

--operatorfunc defaults to no-space #1514

Closed jshier closed 11 months ago

jshier commented 1 year ago

Using 0.52.2, spaces are removed from operator functions by default (no explicit rule). Adding a --operatorfunc spaced to the config file fixes the issue, though that's documented as the default.

jshier commented 1 year ago

Here's the full config. You can see the difference by toggling the --operatorfunc setting.

# file options

--symlinks ignore
--exclude Pods,Carthage
--swiftversion 5.8

# format options

--commas inline
--comments indent
--decimalgrouping 3,5
--enumnamespaces structs-only
--exponentcase lowercase
--exponentgrouping disabled
--extensionacl on-declarations
--fractiongrouping disabled
--ifdef no-indent
--importgrouping testable-top
--nospaceoperators ..<, ...
--operatorfunc spaced
--selfrequired boundingRect
--someAny false
--stripunusedargs closure-only
--wraparguments preserve
--wrapcollections preserve

# rules

--enable isEmpty
--disable andOperator
--disable preferKeyPath
--disable wrapMultilineStatementBraces
nicklockwood commented 1 year ago

@jshier I'm not able to reproduce this with a trivial example. Can you provide a sample Swift file or snippet where this happens?

nicklockwood commented 11 months ago

@jshier any update on this?

jshier commented 11 months ago

I can no longer reproduce it, strange. Thanks for looking.