Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent spacing around - and + operators #1958

Open
milika opened this issue Jan 4, 2025 · 4 comments
Open

Inconsistent spacing around - and + operators #1958

milika opened this issue Jan 4, 2025 · 4 comments

Comments

@milika
Copy link

milika commented Jan 4, 2025

Default config, xcode 16.2

let x = CGFloat(spellPosition.x)*w + w/2
let y = -CGFloat(spellPosition.y)*h-h/2

Top line is formated correctly bottom line goes from

let y = -CGFloat(spellPosition.y)*h - h/2

to the first one for no obvious reason.
Lint reports: spaceAroundOperators violation

@nicklockwood
Copy link
Owner

I'm having trouble reproducing this issue. It also doesn't make sense to me because the default behavior for SwiftFormat is to put spaces around * and / operators, which isn't happening in your example.

Are you using the command line tool or the Xcode extension? If it's the extension, note that the default behavior is to try and infer the configuration from the file unless you uncheck the "Infer Options Automatically" option in thew SwiftFormat for Xcode helper app.

@milika
Copy link
Author

milika commented Jan 19, 2025

If I uncheck "Infer Options Automatically" it works properly. Thanks

What's more now works properly if I recheck that option 👍

Please close the ticket if that is expected behavior

@nicklockwood
Copy link
Owner

It's a little strange, but it's hard to tell if it's a bug without seeing the whole file.

@milika
Copy link
Author

milika commented Jan 19, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants