Skip to content

Conversation

mkurz
Copy link
Member

@mkurz mkurz commented Feb 18, 2020

I don't think formatting on compile is a good idea:
sbt-scalafmt has "format on compile" disabled for very good reasons:

This option is discouraged since it messes up undo buffers in the editor and it slows down compilation. It is recommended to use "format on save" in the editor instead.

Source: https://scalameta.org/scalafmt/docs/installation.html#format-on-compile
IMHO the same applies for java source files.

I think it's much better to disable formatting on compile by default.

Thanks!

Copy link
Contributor

@ennru ennru left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the need we had when creating, this the formatting on compile works nicely. I understand that some editors and tools may have problems with it.

What this Java code formatter lacks is integration with editors/IDEs which would apply the exact same formatting on save.

The documentation must be updated to how the former behaviour is reestablished (eg. by having an in-project auto plugin which triggers the format on compile).

@mkurz
Copy link
Member Author

mkurz commented Feb 19, 2020

@enru thanks for having a look. I updated the scripted tests, the build is green now.

The documentation must be updated to how the former behaviour is reestablished (eg. by having an in-project auto plugin which triggers the format on compile).

I already updated the README with my first commit. Is there another documentation somewhere?
IMHO that should be enough, but when releasing a new version we should add the change to the GitHub release page, so people are aware of that change.

What do you think?

@ennru
Copy link
Contributor

ennru commented Mar 2, 2020

#70 suggests adding the javafmtOnCompile setting, which aligns well with scalafmt.

@ennru ennru mentioned this pull request Mar 2, 2020
@mkurz
Copy link
Member Author

mkurz commented Mar 2, 2020

@ennru I leave it up to you which way to go here. I am totally fine to close this pull request and move forward with #70 instead.

@mkurz
Copy link
Member Author

mkurz commented Mar 3, 2020

Closing in favor of #70

@mkurz mkurz closed this Mar 3, 2020
@ennru
Copy link
Contributor

ennru commented Mar 3, 2020

I'm open to consider changing this in the 0.6.0 release.

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

Successfully merging this pull request may close these issues.

2 participants