Skip to main content

Changelog

For more recent entries, please see Scalafmt Releases.

v2.6.3 (2020-07-10)

Full Changelog

Merged pull requests:

v2.6.2 (2020-07-05)

Full Changelog

Merged pull requests:

v2.6.1 (2020-06-18)

Full Changelog

Merged pull requests:

v2.6.0 (2020-06-16)

Full Changelog

Merged pull requests:

v2.5.3 (2020-05-11)

Full Changelog

Merged pull requests:

  • #1627 [22]: Router: preserve split after =\> in source=keep #1963 (kitbellew)
  • FormatWriter: shift lines after StateColumn align #1962 (kitbellew)

v2.5.2 (2020-05-09)

Full Changelog

Merged pull requests:

v2.5.1 (2020-05-03)

Full Changelog

Merged pull requests:

v2.5.0 (2020-04-30)

Full Changelog

Managed formatting modes

We are defining the newlines.source parameter (see https://scalameta.org/scalafmt/docs/configuration.html#newlinessource), which introduces managed, wholesale changes to how code is formatted. One of the options (keep) is intended to hand control over line breaks to the user, while the other two (fold and unfold) will in fact completely ignore user input.

These modes are new and will potentially have a few bugs here and there (especially keep), in addition to, possibly, causing mixed sentiment of the "this looks almost good, if only we could do this differently" type. That is expected and likely par for the course for an opinionated formatter that scalafmt was intended to be.

However, please submit your bugs and opinions via https://github.com/scalameta/scalafmt/issues/new or comment on existing ones, so that if there are ideas on how to modify the behaviour in a way that resonates with the community, without violating the constraints (for fold/unfold, user input must be ignored), we'll implement them.

Editions

Editions were envisioned as a way to allow formatter upgrades while preserving formatting behaviour, but this turned out to be substantially harder to do, so edition 2020-01 is the last one. Also, the same result can easily be accomplished by not upgrading the formatter.

File overrides

One can customize configuration to apply to a subset of files, based on a file pattern. Cases can include special formatting rules for sbt files, or others for test suites (for instance, using AvoidInfix rewrite for main code with an empty rewrite.neverInfix.excludeFilters while allowing special scalatest DSL for tests with rewrite.neverInfix.excludeFilters containing should etc.).

See https://scalameta.org/scalafmt/docs/configuration.html#fileoverride

Infix formatting

Formatting line breaks around infix expressions turned out to be a difficult problem, and a couple of years ago scalafmt gave up on that and let the user choose where to break. Here, we are defining a couple of parameters to try and take that control back, by adding newlines after an infix operator (as the only universally safe place; there are some cases when a break can happen before an infix operator, but those are rare, and this logic doesn't attempt to discern them).

See https://scalameta.org/scalafmt/docs/configuration.html#newlinesafterinfix

Presets

This is not a new setting but a new, more general way to specify groups of parameters. Previously, you'd use style = defaultWithAlign or align = most or danglingParentheses = true. However, because configuration is represented using HOCON/json, doing it like that meant one couldn't partially override these presets.

The new approach is to define preset = defaultWithAlign, or align.preset = most, or danglingParentheses.preset = true. This way, naming is standardized, and partial overrides are possible.

Please see https://scalameta.org/scalafmt/docs/configuration.html#presets.

Alignment

The major additions, apart from several bug fixes, are

Formatting around implicit and dangling

This was handled in fixed way in classic formatting mode while had some control in verticalMultiline mode. We brought those styles together, by adding a few parameters to control the outcome.

Please see:

Indentation

We added several new options to control indentation:

Top-level statements

In addition to enforcing breaks before top-level statements, we now allow the same after the top-level statements. Also, there's a more granular control of which top-level statements are considered. Please see https://scalameta.org/scalafmt/docs/configuration.html#newlinestoplevelstatements

Rewrites

Literals

A number of new parameters is available to control formatting of numeric literals. Please see https://scalameta.org/scalafmt/docs/configuration.html#literals.

Defaults

The following are changes in default behaviour:

  • newlines.afterCurlyLambda = never: the parameter itself doesn't change, but its behaviour changed since 2.4.2 (a new squash setting mimics the old never); see https://scalameta.org/scalafmt/docs/configuration.html#newlinesaftercurlylambda
  • rewrite.redundantBraces.generalExpressions = true; previously, it was false
  • align.multiline = true: this new setting modifies the behaviour of align.preset = most
  • newlines.alwaysBeforeMultilineDef: there is a change in behaviour due to a bugfix, making this option apply consistently.

Merged pull requests:

v2.5.0-RC3 (2020-04-28)

Full Changelog

Merged pull requests:

  • ContinuationIndent: add granularity to defnSite #1919 (kitbellew)
  • DanglingParentheses: add ctrlSite flag #1918 (kitbellew)
  • FormatWriter bugfix: add margin in the middle only #1917 (kitbellew)
  • FormatWriter: use \h for horizontal whitespace #1916 (kitbellew)
  • Pretty format multiline expressions in enumerator with align.arrowEnumeratorGenerator #1915 (poslegm)
  • Usage of default align token owners #1914 (poslegm)
  • RedundantBraces: fix try with partially enclosed expressions #1913 (kitbellew)
  • FormatWriter: match on any horizontal whitespace #1911 (kitbellew)
  • ScalafmtDynamicRunner: read and format only matching files #1910 (kitbellew)
  • ContinuationIndent: add ability to control "with" #1909 (kitbellew)
  • Newlines: add flexibility to implicitParamListModifier #1908 (kitbellew)
  • AvoidInfix bugs: RedundantParens conflicts, newline before \( #1906 (kitbellew)
  • RedundantParens: fix handling of tuples #1905 (kitbellew)

v2.5.0-RC2 (2020-04-24)

Full Changelog

Merged pull requests:

v2.5.0-RC1 (2020-04-15)

Full Changelog

Merged pull requests:

v2.4.2 (2020-02-22)

Full Changelog

Merged pull requests:

v2.4.1 (2020-02-16)

Full Changelog

Merged pull requests:

v2.4.0 (2020-02-15)

Full Changelog

Merged pull requests:

v2.4.0-RC2 (2020-02-09)

Full Changelog

Merged pull requests:

v2.4.0-RC1 (2020-01-30)

Full Changelog

Merged pull requests:

v2.3.3-RC2 (2020-01-22)

Full Changelog

Merged pull requests:

v2.3.3-RC1 (2020-01-08)

Full Changelog

Merged pull requests:

v2.3.2 (2019-12-08)

Full Changelog

Merged pull requests:

v2.3.1 (2019-12-06)

Full Changelog

Merged pull requests:

v2.3.0 (2019-12-04)

Full Changelog

Merged pull requests:

v2.3.0-RC2 (2019-11-27)

Full Changelog

v2.3.0-RC1 (2019-11-27)

Full Changelog

Merged pull requests:

v2.2.2 (2019-10-29)

Full Changelog

Merged pull requests:

v2.2.1 (2019-10-21)

Full Changelog

Merged pull requests:

v2.2.0 (2019-10-17)

Full Changelog

Merged pull requests:

v2.1.1 (2019-10-11)

Full Changelog

Merged pull requests:

  • Use Coursier defaults, which also adds support for COURSIER_REPOSITORIES #1524 (henricook)
  • Insert newline for else keyword, fixes #1509. #1520 (olafurpg)
  • Add a space between constructor annotations and their parameter lists #1516 (dominics)

v2.1.0 (2019-09-30)

Full Changelog

Merged pull requests:

v2.1.0-RC2 (2019-09-26)

Full Changelog

Merged pull requests:

v2.1.0-RC1 (2019-08-25)

Full Changelog

Merged pull requests:

v2.0.1 (2019-08-12)

This release contains some new features and fixes for regressions. Full Changelog

New features

--list option When you want to check if your files are formatted, you can run scalafmt with the --list flag. This will output a list of unformatted files if any.

$ scalafmt --list

if some of the files require re-formatting, scalafmt print the list of those files and return exit code 1.

src/main/scala/file1.scala
src/main/scala/file1.scala

Merged pull requests:

v2.0.0-RC8 (2019-06-06)

Full Changelog

Merged pull requests:

  • Fixed error with includeNoParensInSelectChains and full qualified names #1429 (poslegm)
  • Fixed spaces.beforeContextBoundColon=IfMultipleBounds behavior for case with subtyping #1428 (poslegm)
  • Fixed bug with RedundantBraces for string interpolation #1425 (poslegm)
  • Remove space for variance annotations with underscore #1419 (vlovgr)
  • Add the CLI option to fetch only recently changed files for formatting. #1416 (stremlenye)
  • Use a simple cache based on futures to avoid redownloading on concurrent usage #1384 (jrudolph)
  • Upgrade IntelliJ plugin #1381 (olafurpg)
  • Upgrade to latest scalafmt. #1380 (olafurpg)
  • Update changelog and document release process #1379 (olafurpg)
  • Avoid newlines after yield keyword. #1378 (olafurpg)
  • Update website for sbt-scalafmt 2.0.0-RC5 #1377 (tanishiking)

v2.0.0-RC6 (2019-04-04)

Full Changelog

Merged pull requests:

v2.0.0-RC5 (2019-02-28)

Full Changelog

Merged pull requests:

v2.0.0-RC4 (2019-01-07)

Full Changelog

Merged pull requests:

v2.0.0-RC3 (2019-01-07)

Full Changelog

Merged pull requests:

  • Add custom reporter endpoint for missing scalafmt version #1340 (olafurpg)

v2.0.0-RC2 (2019-01-07)

Full Changelog

Merged pull requests:

v2.0.0-RC1 (2019-01-07)

Full Changelog

Merged pull requests:

v1.6.0-RC4 (2018-07-09)

Full Changelog

Merged pull requests:

v1.6.0-RC3 (2018-06-10)

Full Changelog

Merged pull requests:

v1.6.0-RC2 (2018-06-05)

Full Changelog

Merged pull requests:

v1.6.0-RC1 (2018-05-27)

Full Changelog

Merged pull requests:

v1.5.1 (2018-04-26)

Full Changelog

Merged pull requests:

v1.5.0 (2018-04-23)

Full Changelog

Merged pull requests:

v1.4.0 (2017-12-18)

Full Changelog

Merged pull requests:

  • Add an "original code" section the issue template #1092 (dwijnand)
  • Fix version number in website and document pre-release. #1089 (olafurpg)
  • Add -r bintray:scalameta/maven to Coursier install commands #1088 (lloydmeta)
  • Use - instead of + in snapshot versions #1082 (olafurpg)
  • Point to a correct project on scaladex #1071 (alenkacz)
  • Bump dependencies versions #1070 (loskutov)
  • Add Mendix to the list of adopters #1066 (nerush)
  • Document that RedundantBraces may cause non-idempotent formatting. #1057 (olafurpg)
  • Empty input with --diff and --stdin is okay #1093 (yln)
  • Introduce "default", "akka" and "akka-http" as IndentOperator config #1090 (daddykotex)
  • Fix file not found errors when running from a subdirectory w/ project.git = true #1087 (lloydmeta)
  • New scalafmt sbt plugin #1085 (vovapolu)
  • No space in by-name params #1079 (vovapolu)

v1.3.0 (2017-09-24)

Full Changelog

Merged pull requests:

  • add missing wonderbar to the optIn.breakChainOnFirstMethodDot code examples #1046 (esarbe)
  • Disabling alignment helps minimizing git diffs #1045 (nightscape)
  • Add http4s to adopters list #1036 (aeons)
  • Repository transfer scmInfo: olafurpg => scalameta #1034 (MasseGuillaume)
  • Fix new GitOpsTest on OSX #1030 (olafurpg)
  • Use the encoding option when writing files, too. #1053 (alexdupre)
  • AsciiSortImports is now incompatible with ExpandImportSelectors. Fixes #1024 #1048 (Lasering)
  • Add optIn.breaksInsideChains = true #1037 (olafurpg)
  • Git testing framework and fix for some git-file-fetching issues #1028 (pjrt)
  • Return non-zero exit code in ./scalafmt if no files match filter #1025 (yln)

v1.2.0 (2017-08-11)

Full Changelog

Merged pull requests:

  • Tweak Coursier installation instructions #1011 (dwijnand)
  • [typo] bin.packParentConstructors => binPack.parentConstructors #1009 (ronanM)
  • Enable mima binary checks in CI. #1017 (olafurpg)
  • Hacky hacks to fix off-by-two errors #1016 (olafurpg)
  • Update to sbt 1.0.0 #1015 (olafurpg)
  • Fail fast on invalid .scalafmt.conf when running with no args. #1014 (olafurpg)
  • Use the VCS root as a potential config path in the IntelliJ plugin #1007 (stuhood)
  • Implement option for discarding whitespace between a keyword and left-paren #998 (nrinaudo)
  • Add support for inserting a line break between a curly if and an else. #996 (nrinaudo)

v1.1.0 (2017-07-09)

Full Changelog

Merged pull requests:

v1.0.0-RC4 (2017-06-17)

Full Changelog

v1.0.0 (2017-06-17)

Full Changelog

v1.0.0-RC3 (2017-06-14)

Full Changelog

Merged pull requests:

v1.0.0-RC2 (2017-06-08)

Full Changelog

Merged pull requests:

v1.0.0-RC1 (2017-05-26)

Full Changelog

Merged pull requests:

v0.7.0-RC1 (2017-04-23)

Full Changelog

Merged pull requests:

v0.6.8 (2017-04-06)

Full Changelog

Merged pull requests:

  • Auto publish docs on merge to master, fixes #764 #877 (olafurpg)

v0.6.7 (2017-04-05)

Full Changelog

Merged pull requests:

v0.6.6 (2017-03-20)

Full Changelog

Merged pull requests:

v0.6.5 (2017-03-18)

Full Changelog

Merged pull requests:

v0.6.4 (2017-03-14)

Full Changelog

Merged pull requests:

  • Use custom cache dir, second attempt at #807 #834 (olafurpg)

v0.6.3 (2017-03-13)

Full Changelog

Merged pull requests:

v0.6.2 (2017-03-07)

Full Changelog

v0.6.1 (2017-03-06)

Full Changelog

v0.6.0 (2017-03-06)

Full Changelog

Merged pull requests:

v0.5.8 (2017-03-03)

Full Changelog

Merged pull requests:

  • #763 Fix Varargs expansion shouldn't be split #772 (tgodzik)
  • Make sure to always resolve HOCON config #771 (dwijnand)
  • #759 filter out deleted files on --diff #770 (tgodzik)
  • Fix vertical alignment on last block of file #769 (dwijnand)
  • Generalise and structure the issue template #766 (dwijnand)
  • Clarify config values & examples some #761 (dwijnand)
  • fix isTopLevelStatement for edge-cases #750 (Daxten)
  • #739: AvoidInfix Bug #749 (ysusuk)
  • Upgrade to meta 1.6 #746 (olafurpg)
  • Remove 'HEAD' from git diff, to include all uncommitted changes aswell #742 (bjornj12)
  • Fix #731: empty-param group with vertical style #734 (pjrt)
  • Add flag for newline before toplevel statements #733 (Daxten)
  • #726: unimport is not respected #729 (ysusuk)

v0.5.7 (2017-02-24)

Full Changelog

Merged pull requests:

v0.5.6 (2017-02-08)

Full Changelog

Merged pull requests:

  • #709: Feature request: AvoidInfix rewrite #715 (ysusuk)
  • Fix #710: Extra space added for unary operations #714 (pjrt)
  • Add Iurii Susuk to the team! #713 (olafurpg)
  • #706: Migrate to scalafix patches #712 (ysusuk)
  • Another fix for verticalMultilineAtDefinitionSite #711 (pjrt)
  • Fix #672, edge case with inline comment #708 (olafurpg)

v0.5.5 (2017-02-01)

Full Changelog

Merged pull requests:

  • #690: Support check for "redundant enclosing brace" in string interpo... #703 (ysusuk)
  • Add new "Team" section in readme #702 (olafurpg)
  • Fix issue on verticalMultilineAtDefinitionSite #700 (pjrt)

v0.5.4 (2017-01-26)

Full Changelog

Merged pull requests:

  • Fix #697, unary operator to symbolic ident #698 (olafurpg)
  • Adds a new style for function defs #682 (pjrt)

v0.5.3 (2017-01-24)

Full Changelog

v0.5.3-RC1 (2017-01-23)

Full Changelog

Merged pull requests:

v0.5.2 (2017-01-22)

Full Changelog

Merged pull requests:

v0.5.2-RC1 (2016-12-28)

Full Changelog

Merged pull requests:

v0.5.1 (2016-12-23)

Full Changelog

Merged pull requests:

v0.5.0 (2016-12-23)

Full Changelog

v0.5.0-RC4 (2016-12-21)

Full Changelog

Merged pull requests:

v0.5.0-RC3 (2016-12-20)

Full Changelog

Merged pull requests:

v0.5.0-RC2 (2016-12-18)

Full Changelog

Merged pull requests:

v0.5.0-RC1 (2016-12-18)

Full Changelog

Merged pull requests:

v0.4.10 (2016-11-10)

Full Changelog

Merged pull requests:

v0.4.9 (2016-11-04)

Full Changelog

Merged pull requests:

v0.4.8 (2016-10-25)

Full Changelog

Merged pull requests:

  • Add flag: newlines.neverInResultType. Fixes #496 #555 (olafurpg)
  • Replace java.io.File with custom AbsoluteFile. #554 (olafurpg)
  • Handle Pat.Interpolate, fixes #512 #550 (olafurpg)
  • Infix applications to count towards valign depth, fixes #531 #549 (olafurpg)
  • Use constant instead of strings and remove useless statement in SBT #548 (joan38)
  • Move Settings at project level #544 (joan38)
  • Fix broken test. #539 (olafurpg)
  • Format on save and update the notification system #534 (joan38)
  • WIP Break select chain on curly braces #532 (olafurpg)
  • Allow --config to be absolute path #528 (olafurpg)

v0.4.7 (2016-10-17)

Full Changelog

Merged pull requests:

v0.4.6 (2016-10-11)

Full Changelog

Merged pull requests:

v0.4.5 (2016-10-10)

Full Changelog

Merged pull requests:

v0.4.4 (2016-10-07)

Full Changelog

Merged pull requests:

  • Add scala-reflect back, fixes #492. #495 (olafurpg)
  • Distinction between Import braces and string interpolation braces #424 #454 (hasumedic)

v0.4.3 (2016-10-05)

Full Changelog

Merged pull requests:

v0.4.2 (2016-09-28)

Full Changelog

Merged pull requests:

v0.4.1 (2016-09-27)

Full Changelog

v0.4.0 (2016-09-27)

Full Changelog

Merged pull requests:

0.4 (2016-09-23)

Full Changelog

Merged pull requests:

  • Move configuration to HOCON #459 (olafurpg)
  • Bump scala.meta version to 1.1.0 #452 (olafurpg)
  • #356 Code with windows line endings after formatting still has windows endings #445 (mmatloka)

v0.3.2-RC4 (2016-09-14)

Full Changelog

v0.3.2-RC3 (2016-09-14)

Full Changelog

v0.3.2-RC1 (2016-09-14)

Full Changelog

v0.3.2-RC2 (2016-09-14)

Full Changelog

Merged pull requests:

v0.3.1 (2016-08-24)

Full Changelog

Merged pull requests:

v0.3.0 (2016-08-17)

Full Changelog

Merged pull requests:

v0.3.0-RC1 (2016-08-13)

Full Changelog

Merged pull requests:

v0.2.12 (2016-08-05)

Full Changelog

Merged pull requests:

  • Increase control over infix operator indentation, fixes #367. #372 (olafurpg)
  • Add spaceBeforeContextBoundColon option #369 (triggerNZ)
  • Updated sbt-assembly to 0.14.3 #361 (VEINHORN)
  • Fix indent expire token for lambdas, towards #357 #358 (olafurpg)

v0.2.11 (2016-07-08)

Full Changelog

v0.2.10 (2016-06-30)

Full Changelog

v0.2.9 (2016-06-30)

Full Changelog

Merged pull requests:

v0.2.8 (2016-06-23)

Full Changelog

v0.2.7 (2016-06-23)

Full Changelog

v0.2.6 (2016-06-22)

Full Changelog

Merged pull requests:

v0.2.6-RC1 (2016-06-01)

Full Changelog

Merged pull requests:

v0.2.5 (2016-05-17)

Full Changelog

v0.2.4 (2016-05-16)

Full Changelog

Merged pull requests:

v0.2.3 (2016-05-06)

Full Changelog

Merged pull requests:

v0.2.2 (2016-04-19)

Full Changelog

Merged pull requests:

v0.2.1 (2016-04-14)

Full Changelog

Merged pull requests:

v0.2.0 (2016-04-12)

Full Changelog

Merged pull requests:

v0.1.6 (2016-04-05)

Full Changelog

Merged pull requests:

v0.1.5 (2016-04-01)

Full Changelog

Merged pull requests:

v0.1.4 (2016-03-18)

Full Changelog

Merged pull requests:

v0.1.3 (2016-03-11)

Full Changelog

Merged pull requests:

v0.1.2 (2016-03-10)

Full Changelog

Merged pull requests:

v0.1.1 (2016-03-08)

Full Changelog

Merged pull requests:

  • Format all files in directory with cli. #92 (olafurpg)

v0.1.0 (2016-03-07)

Full Changelog

Merged pull requests:

v0.1.0-RC3 (2016-03-04)

Full Changelog

Merged pull requests:

v0.1.0-RC2 (2016-03-03)

Full Changelog

Merged pull requests:

v0.1.0-RC0 (2016-02-09)

Full Changelog

Merged pull requests:

* This Changelog was automatically generated by github_changelog_generator