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

Make swift-format default behavior friendlier when passed no arguments #871

Open
janniksam opened this issue Nov 5, 2024 · 6 comments
Open

Comments

@janniksam
Copy link

janniksam commented Nov 5, 2024

Environment:

  • WSL2 Ubuntu 20.04
  • Swift 6.0.2

I saw #861 and created a .swift-format file in the project dir (also tried on layer above), but I'm still having issues with a hanging swift-format.

image

is there a way to enable verbose diagnostics for swift-format or is there any other method to find out, where its getting stuck?
Do I maybe just have to wait for 6.0.3?

@allevato
Copy link
Member

allevato commented Nov 5, 2024

Running swift-format without any arguments will wait for input from stdin. You need to pass a few flags to have it format files in place. What you might want is something like swift-format -r -i ..

There's some good discussion about the default behavior being less-than-intuitive here: https://forums.swift.org/t/default-behavior-of-swift-format/74314. It's something we'd like to improve in the future.

@ahoppen
Copy link
Member

ahoppen commented Nov 5, 2024

Synced to Apple’s issue tracker as rdar://139283088

@janniksam
Copy link
Author

Running swift-format without any arguments will wait for input from stdin. You need to pass a few flags to have it format files in place. What you might want is something like swift-format -r -i ..

There's some good discussion about the default behavior being less-than-intuitive here: https://forums.swift.org/t/default-behavior-of-swift-format/74314. It's something we'd like to improve in the future.

Thank you, working like a charm when you do it right. I feel dumb now. :)

@allevato
Copy link
Member

allevato commented Nov 5, 2024

Thank you, working like a charm when you do it right. I feel dumb now. :)

You shouldn't! It's good signal that we can do more to smooth out the on-boarding process.

I'll go ahead and close this since it's resolved.

@allevato allevato closed this as completed Nov 5, 2024
@ahoppen
Copy link
Member

ahoppen commented Nov 5, 2024

Let’s keep this issue open to consider a potential default behavior change of swift-format without any arguments.

@ahoppen ahoppen reopened this Nov 5, 2024
@allevato allevato changed the title Swift-Format hangs on swift 6.0.2 Make swift-format default behavior friendler when passed no arguments (was: Swift-Format hangs on swift 6.0.2) Nov 5, 2024
@allevato
Copy link
Member

allevato commented Nov 5, 2024

That's fine. I've updated the title to better reflect what we want to do.

@allevato allevato changed the title Make swift-format default behavior friendler when passed no arguments (was: Swift-Format hangs on swift 6.0.2) Make swift-format default behavior friendlier when passed no arguments (was: Swift-Format hangs on swift 6.0.2) Nov 5, 2024
@ahoppen ahoppen changed the title Make swift-format default behavior friendlier when passed no arguments (was: Swift-Format hangs on swift 6.0.2) Make swift-format default behavior friendlier when passed no arguments Nov 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants