New formatter haxelib library

Formatter 1.10.1 was just released!

It includes numerous bugfixes and a few new features:

  • formatter can now detect files with merge conflicts and will not try to format them
  • it added lineEnds.anonFunctionCurly so you can have different curly linebreak settings if they occur as a block of an anonymous function
  • with wrapping.casePattern you can define wrapping rules that deal with cases that hold a long list of patterns, e.g.
case Kwd(KwdIf) | Kwd(KwdElse) | Kwd(KwdTry) | Kwd(KwdCatch) 
        | Kwd(KwdDo) | Kwd(KwdWhile) | Kwd(KwdFor) | Kwd(KwdFunction)
        | Kwd(KwdSwitch) | Kwd(KwdReturn) | Kwd(KwdUntyped) | Arrow:
  • there is a new wrapping condition type called exceedsMaxLineLength which will match lines that are longer than maxLineLength setting (pre-wrapping)

As is tradition there is also a new vshaxe release (2.19.2) that includes all formatter related changes and bugfixes.
Formatter 1.10.1 brings a fix for those using formatOnPaste in VSCode, it should no longer add an extra space when your paste ends inside an identifier or string literal.

Fun side note: If you ever need to run an older version of Formatter you can just run haxelib run formatter:1.9.2 -s src (assuming you have a matching haxelib version installed)

4 Likes