I’d like to stop scalafmt from rearranging/deleting/replacing my imports. I haven’t used the rewrite rules SortImports
or AsciiSortImports
(and I don’t think any of my other settings should mess with imports either).
One problem I have is that scalafmt rearranges imports in an order I don’t like (I have them separated into three groups with blank lines in between, and scalafmt turns them into two).
A more annoying issue is that Scala 3 wildcards are deleted. An import like import com.foo.*
becomes import com.foo
, and an import like import Foo.*
just gets deleted. This means that every time I format the file, I have to go back and fix all the imports.
I understand that Scala 3 is new and support for it won’t be perfect yet, but this is really hampering my productivity. Is there any way to disable import-related fixes?
Here is my .scalafmt.conf
file, if it matters:
version = 3.0.0-RC2
runner.dialect = scala3
maxColumn = 100
align.preset = some
continuationIndent.callSite = 4
continuationIndent.defnSite = 4
continuationIndent.extendSite = 4
rewrite.rules = [RedundantParens]
optIn.breakChainOnFirstMethodDot = false
newlines.afterCurlyLambda = never
newlines.alwaysBeforeElseAfterCurlyIf = false
newlines.alwaysBeforeMultilineDef = false
verticalMultiline.atDefnSite = false
verticalMultiline.newlineAfterOpenParen = false
rewrite.scala3.convertToNewSyntax = true