Skip to content

Instantly share code, notes, and snippets.

@gvolpe
Created April 21, 2023 12:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gvolpe/0e94955c261ce33d2eda8b26213fafd2 to your computer and use it in GitHub Desktop.
Save gvolpe/0e94955c261ce33d2eda8b26213fafd2 to your computer and use it in GitHub Desktop.

Scalafmt config

How can I get scalafmt to format my case class like this?

case class Person(
    name: String,
    age: Int
) derives Eq, Show

As opposed to what's happening right now:

case class Person(
    name: String,
    age: Int
) derives Eq, 
         Show
version = 3.6.1
runner.dialect = scala3
style = defaultWithAlign
maxColumn = 100
project {
git = true
}
rewrite {
scala3 {
convertToNewSyntax = true
removeOptionalBraces = true
insertEndMarkerMinLines = 30
removeEndMarkerMaxLines = 29
}
trailingCommas.style = never
}
fileOverride {
"glob:**/build.sbt" {
runner.dialect = scala213
}
"glob:**/project/**" {
runner.dialect = scala213
}
}
newlines.topLevelStatementBlankLines = [
{
minBreaks = 2
blanks { before = 1 }
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment