v2.7.0
Editions
- Edition: remove this feature completely (#2109) @kitbellew
CLI
In order to allow specifying a large number of files to the command-line tool, we now allow providing them via @file
argument; this file
will contain the names of all files and directories which would otherwise have been specified directly on the command line. A special case of @-
is to refer to stdin
.
- Add support to expand command-line arguments with @ symbol (#2146) @olafurpg
- Cli: add an option to read file names from stdin (#2162) @kitbellew
Ammonite
- Scalafmt: support
@
-reloaded Ammonite scripts (#2182) @kitbellew - TokenTraverser: exclude shebang line in ammonite (#2159) @kitbellew
Consistent formatting of body of definitions and control expressions
Previously, there was a single parameter (newlines.alwaysBeforeMultilineDef
) which allowed to force a line break after =
if the body of a method occupied multiple lines.
In this release, this parameter is deprecated and replaced with another multivalued parameter; NB: to enable this transition, the default behaviour was changed from forcing a break to allowing a space.
Additionally, when a break is not forced, formatting of body in method definition, variable assignment, control expressions (if
, for
, while
), case clauses has been standardized and controlled via the same parameters (with methods, for backwards compatibility, being optionally configured via a separate parameter).
- Parameters:
- Pull requests:
- Router: amend folded body to cover infix chains (#2185) @kitbellew
- Router: standard rule for body of def/if-else/case (#2158) @kitbellew
- Router: fix when comments follow
=
in def/val (#2123) @kitbellew
Indentation of infix chains
Previously, indentation with infix chains was applied inconsistently, occasionally failing altogether. In this release, indentation has been made more consistent and applied universally, with parameters documented.
- Parameters:
- Documented
indentOperator
- Added
indentOperator.topLevelOnly
- Documented
- Pull requests:
- FormatOps: fix infix indentation (#2180) @kitbellew
- IndentOperator: move topLevelOnly and document (#2173) @kitbellew
Formatting of lambdas and partial functions
- Changes:
- Formatting of single-case partial functions like lambdas, breaking after the parameters
- Parameters:
- Pull requests:
- Router: prefer not breaking before lambda params (#2125) @kitbellew
- Newlines: rename afterCurlyLambda{,Params} (#2110) @kitbellew
- Router: allow space after "{" in partial functions (#2108) @kitbellew
Formatting of paren-enclosed case body as with braces
- FormatOps: improve isCaseBodyEnclosedAsBlock (#2181) @kitbellew
- Router: format ()-enclosed case clause as a block (#2165) @kitbellew
Rewrite rules
- Dedicated setting for redundant braces in if-else (#2115) @poslegm
- Bug fixes:
- RedundantParens: look for NL before nested infix ops (#2164) @kitbellew
- RedundantBraces: fix method block as apply arg (#2161) @kitbellew
- Rewrite: replace delimiters with space (#2121) @kitbellew
- Fix a problem where parens are removed after a yield (#2118) @daddykotex
Miscellaneous
- [documentation] fix brace in example (#2178) @bluesheeptoken
- Release moved from Travis to GitHub Actions (#2139) @poslegm
- Install script compatibility with auto-uploaded artifacts (#2116) @poslegm
- Job for automatic native images uploading (#1711) (#2114) @poslegm
- Update links to Spotless integrations. (#2112) @nedtwigg
- Bug fixes:
- Router: attached comment as optimal in def body (#2184) @kitbellew
- Newlines: rename {never,avoid}InResultType (#2183) @kitbellew
- FormatWriter: fix align container logic for multiline alignment (#2160) @kitbellew
- FormatToken: ensure break before/after docstring (#2128) @kitbellew
- Router: delay break if detached comment follows
{
(#2126) @kitbellew - Router: prefer case break after
=>
overif
(#2119) @kitbellew
Dependency updates
- self formatting 2.6.4 (#2134) @poslegm
- Update sbt-scalafmt to 2.4.2 (#2170) @scala-steward
- Update sbt-mdoc to 2.2.5 (#2169) @scala-steward
- Update sbt-native-packager to 1.7.5 (#2167) @scala-steward
- Update sbt-buildinfo to 0.10.0 (#2166) @scala-steward
- Update scalatest to 3.2.2 (#2172) @scala-steward
- Update scalameta, testkit to 4.3.21 (#2171) @scala-steward
- Update sbt-scalajs to 1.1.1 (#2131) @scala-steward