My .scalafmt.conf
file content is:
version = 3.5.4
IntelliJ downloaded scalafmt
for this version:
But when I want to format a file, I get a really confusing error:
IntelliJ version:
IntelliJ IDEA 2022.1.1 (Community Edition)
Build #IC-221.5591.52, built on May 10, 2022
How to solve this problem?
You should explicitly specify runner.dialect
. In the case of Scala 3, add runner.dialect = scala3
.
Example final content of .scalafmt.conf
:
version = 3.9.2
runner.dialect = scala3
rewrite.scala3.convertToNewSyntax = true
rewrite.scala3.removeOptionalBraces = true
See https://scalameta.org/scalafmt/docs/configuration.html#scala-dialects
As for non-descriptive error message see https://youtrack.jetbrains.com/issue/SCL-20123