scala-cli
scala-cli copied to clipboard
scala-cli fmt not working with rewrite.
Version(s) 1.1.1 Describe the bug
PS C:\Users\hepin\IdeaProjects\incubator-pekko> scala-cli fmt
scala.meta.Dialect.withAllowAsForImportRename(boolean)
Run scala-cli fmt on Windows ,only prints this line above, no formatting.
With:
rewrite.scala3.convertToNewSyntax = false
runner {
dialectOverride {
allowAsForImportRename = false
allowStarWildcardImport = false
allowPostfixStarVarargSplices = false
}
}
It works when run in sbt shell.
To Reproduce
Change the .sbtfmt.conf in pekko project. and run scala-cli fmt.
Expected behaviour Should be ok
Some notes after a quick spike
- this is specific to the
scalafmtnative launcher (https://github.com/VirtusLab/scalafmt-native-image) - as we have no native launcher for M1/aarch64, Scala CLI defaults to the JVM launcher for that platform and thus, this is not replicable on M1 machines (unless you download the native launcher manually and replicate the problem with that)
- the error we are getting seems to be the same one as when passing an invalid key in the configuration, which implies this particular key does not exist in the
scalafmt-native-imagelauncher - I've no idea what could be causing this
Potential further steps:
- figure out what's different about
scalafmt-native-image(perhaps we're accidentally using a wrong version of some dependency in there?) - add a flag to force the platform for the
scalafmtlauncher, so that we have a workaround with the JVM launcher (ugh)
Thanks, and I's using Window 11, and thanks for this great tool.
Optimally, this should be fixed by bringing https://github.com/scalameta/scalafmt/pull/2846 to a closure.