New
v3.10.4
Features
This release has a number of features and fixes to allow scalafmt adoption to extend to scala.js as well.
- improve handling of
rewrite.insertBracesfunctionality- InsertBlocks: add
settingsandoverrideFor(#5172) @kitbellew- FormatWriter: use InsertBraces.countBreakBefore (#5170) @kitbellew
- MissingBraces: include method result type as well (#5168) @kitbellew
- MissingBraces: extract all nested if-else blocks (#5164) @kitbellew
- MissingBraces: ensure right brace belongs to body (#5163) @kitbellew
- MissingBraces: return some parts as non-blocks (#5162) @kitbellew
- MissingBraces: implement for if-then, for-do (#5161) @kitbellew
- InsertBraces: fix renaming maxLines to maxBreaks (#5159) @kitbellew
- InsertBraces: rename
maxLinestomaxBreaks(#5157) @kitbellew
- InsertBraces: rename
- MissingBraces: pass InsertBlocks, get case class (#5158) @kitbellew
- InsertBlocks: add
- Splits: use comments.indentTrailingInCaseBody (#5166) @kitbellew
- Splits: use optional beforeParenLambdaParams (#5147) @kitbellew
- IndentOperator: allow multiple
exemptScopevals (#5130) @kitbellew- InfixSplits: turn
indents.infixinto array (#5148) @kitbellew - Indents: fix section rename bug (lengthCompare 0) (#5150) @kitbellew
- InfixSplits: turn
- add new infix style which preserves existing breaks but possibly adds new ones
- Infix.Style: rename keep to none, keepNL to keep (#5110) @kitbellew
- FormatOps: don't break before infix arg in braces (#5124) @kitbellew
- FormatOps: handle infix=keepNL even more correctly (#5122) @kitbellew
- FormatOps: handle infix=keepNL correctly (#5121) @kitbellew
- FormatOps: in getSlbEndOnLeft, ignore keepNL (#5120) @kitbellew
- FormatOps: refactor insideInfixSplit (#5118) @kitbellew
- Newlines: add InfixSite.isNone, revise checkConfig (#5119) @kitbellew
- InfixSplits: refactor intermediate expires (#5117) @kitbellew
- FormatOps: detect valid break before infix better (#5116) @kitbellew
- Infix, CtrlBody: extend single line to include comment (#5113) @kitbellew
- InfixSplits: keep: expire SLB before op, not after (#5109) @kitbellew
- Newlines: add a new infix style option,
keepNL(#5107) @kitbellew - Newlines: disallow afterInfix=keep if source!=keep (#5106) @kitbellew
- Infix/ctrl body: at times treat parens as braces (#5103) @kitbellew
- allow adding blanks not just on top-level statements
- FormatWriter: improve blank detection in alignment (#5096) @kitbellew
- FormatWriter: allow blanks in non-top-level stats (#5095) @kitbellew
- Newlines.TopStatBlanks: add parent matching, too (#5094) @kitbellew
- FormatWriter: refactor topStatBlanks logic (#5093) @kitbellew
- PreferCurlyFors: also optionally include if-guards (#5091) @kitbellew
- ImportSelectors: add
keepoption (#5086) @kitbellew
Bug fixes
- Imports: don't just accidentally add Imports rule (#5173) @kitbellew
- TreeOps: find nested braces in an ancestor (#5171) @kitbellew
- FormatWriter: check leading comments to add braces (#5169) @kitbellew
- FormatWriter: fix formatting of multiline comments (#5167) @kitbellew
- Splits: handle comment between
while ()and{(#5160) @kitbellew - FormatOps: to unfold CtrlBody, keep break if can (#5153) @kitbellew
- FormatOps: delay oneline-arg policy until the arg (#5152) @kitbellew
- Splits: do not unindent blocks within parens (#5149) @kitbellew
- ScalafmtConfig: sort fileOverride patterns (#5146) @kitbellew
- Splits: format tucked try-catch like if-else (#5145) @kitbellew
- PolicyOps: fix unindent, since ranges are reversed (#5144) @kitbellew
- Policy.RelayOnSplit: use
beforeunless triggered (#5142) @kitbellew - Splits: use binpack indent for single-arg lambda (#5141) @kitbellew
- InfixSplits: force SLB optimal for assignment ops (#5137) @kitbellew
- InfixSplits: fix SLB indent length, expiration (#5139) @kitbellew
- InfixSplits: handle assignment operators better (#5132) @kitbellew
- TreeExtractors: switch to scalameta precedence (#5131) @kitbellew
- FormatOps: NL before single-line infix braces arg (#5125) @kitbellew
- Splits: caret can belong to CapSetName, too (#5114) @kitbellew
- FormatTokens: fix bugs in getNonMultilineEnd (#5108) @kitbellew
- FormatTokens: blank line interrupts multiline (#5104) @kitbellew
- FormatWriter: improve detection of scaladoc lists (#5092) @kitbellew
- Splits: preserve blank line between arguments (#5090) @kitbellew
- Splits: disable kill-on-fail if scala.js-style (#5088) @kitbellew
- RedundantBraces: check line span for ctors as well (#5087) @kitbellew
Miscellaneous
- StyleMap: allow overriding
initat top of file (#5175) @kitbellew - FormatOps: get initStyle from StyleMap (#5174) @kitbellew
- FormatOps: move isJsNative to TreeOps (#5156) @kitbellew
- Splits: massage yield w/ nested multi-branch (#5155) @kitbellew
- FormatOps: restore literalArgList binpack priority (#5154) @kitbellew
- FormatOps: detect binpack site args correctly (#5151) @kitbellew
- Policy: print nested policies in parentheses (#5143) @kitbellew
- InfixSplits: cosmetic, expose nextInfixes (#5140) @kitbellew
- FormatTests: assert state visits if specified (#5138) @kitbellew
- InfixSplits: include
fullInfixEnclosedInflag (#5134) @kitbellew - InfixSplits: extract helpers in skipInfixIndent (#5129) @kitbellew
- IndentOperator: use
Conf.nameOf, not literals (#5128) @kitbellew - InfixSplits: detect enclosed RHS even beforeLHS (#5101) @kitbellew
- InfixSplits: enforce break around nested infix (#5100) @kitbellew
- InfixSplits: refactor findNextInfixes (#5098) @kitbellew
- InfixSplits: refactor getting next infix op (#5099) @kitbellew
- InfixSplits: spaceSplits to otherSplitsNoDelims (#5097) @kitbellew
- InfixSplits: remove
predinfindNextInfixes(#5102) @kitbellew - BestFirstSearch: refactor, overload killOnFail (#5089) @kitbellew
Build and dependency updates
- scalameta: upgrade to v4.14.5 (#5176) @kitbellew
- Update sbt, scripted-plugin to 1.12.0 (#5136) @scalameta-bot
- Update sbt-scalajs, scalajs-compiler, ... to 1.20.2 (#5135) @scalameta-bot
- HasTests: improve prefix detection (#5133) @kitbellew
- metaconfig: upgrade to v0.18.2 (#5127) @kitbellew
- Bump release workflows to
macos-15/macos-15-intelrunners (#5126) @Gedochao - FormatTest: debug only the first run, not [WIN] (#5123) @kitbellew
- scalameta: upgrade to 4.14.4 (#5115) @kitbellew
- DiffTest: verbose debug for explicit ONLY tests (#5105) @kitbellew
- Formatter: upgrade to v3.10.3 (#5085) @kitbellew