scalameta / sbt-scalafmt

sbt plugin for Scalafmt
https://scalameta.org/scalafmt/
Apache License 2.0
203 stars 43 forks source link

Please document how to apply configuration settings on the web site #304

Open ConradHughes opened 8 months ago

ConradHughes commented 8 months ago

The scalafmt sbt plugin web site describes some useful settings here — for example scalafmtFilter. However it doesn't say how to actually set these settings, and doing that seems to be somewhat non-obvious. For example, you might naively think .scalafmt.conf wouldn't be a bad place to try, but apparently it is (a bad place to try).

It would be helpful if the web site documentation provided an example of your recommended approach to configuring some, if not all, of the listed settings.

It took a while to find that I could add

scalafmtFilter := "diff-dirty"

… to build.sbt, but even this raised continuous complaints until modified to the arcane-looking

scalafmtFilter.withRank(KeyRanks.Invisible) := "diff-dirty"

… if this is indeed the canonical way to achieve this setting, then well and good, but it might save others time and confusion if something similar appeared in the settings documentation.

Thanks very much for your work.

kitbellew commented 8 months ago

@ConradHughes please feel free to send in a pr with these changes. i am not sure we have any experts on using sbt as the nuance of .withRank(...) is lost on me.

kitbellew commented 8 months ago

i have also transferred this issue to the sbt plugin repo. you may have noticed the issue template for the original repository was focused on formatting problems and directed any sbt requests to this repo instead.

ConradHughes commented 8 months ago

Thanks for your response @kitbellew, and sorry for the slow action on this; I will try to get you a PR some time soon.