lassik / emacs-format-all-the-code

Auto-format source code in many languages with one command
https://melpa.org/#/format-all
MIT License
611 stars 106 forks source link

scalafmt: Add --stdout as workaround for odd behaviour #238

Closed emdash-ie closed 1 year ago

emdash-ie commented 1 year ago

Sometimes, scalafmt does not produce formatted output to stdout with only the --stdin flag provided. For example, this happens when there are no formatting changes required to be made to the file. As-is, this causes the formatter to clear the buffer when there are no formatting changes required.

As a workaround, adding the --stdout flag ensures that output is always put on stdout.

See https://github.com/scalameta/scalafmt/issues/3632 for more information.

emdash-ie commented 1 year ago

The response on the linked issue has now clarified that --stdin does not imply --stdout – the help text was incorrect. Therefore this is no longer a workaround but a fix.

lassik commented 1 year ago

Good catch! Thanks for clearing up the issue with the scalafmt authors.

emdash-ie commented 1 year ago

Glad to help :)