github JohnnyMorganz/StyLua v0.9.0

latest releases: v0.20.0, v0.19.1, v0.19.0...
2 years ago

[0.9.0] - 2021-06-15

Added

  • CLI will now look for stylua.toml and its hidden counterpart, .stylua.toml. (#145)
  • Added CLI flag --search-parent-directories. If enabled, we will look in parent directories for a configuration file, or look in $XDG_CONFIG_HOME or $XDG_CONFIG_HOME/stylua. (#127, #146)
  • Updated full-moon: Added support for typed variadics, named function type args, and generic functions under the Luau feature flag
  • Will now hang on equality operators within binary expressions, if over width.
  • If a file path is explicitly provided to the CLI which doesn't end with .lua ending, the *.lua glob check is skipped. (#170)
  • Long type unions will now hang under the luau feature flag. (#165)
  • Added option no_call_parentheses. Enabling this config will remove parentheses around function calls taking a single string/table as an argument. This config was added for adoption purposes. (#133)

Changed

  • Long prefix expressions which are hangable and go over the line limit (e.g. ("foooo" .. "barrrrrrr" .. "bazzzzzz"):format(...)) will now hang multiline (#139)
  • Changed formatting for assignments. We will now try all tactics then determine the best one. Multiple assignments will now no longer attempt to hang a single expression first - we will hang the whole punctuated list. (#157)
  • Function calls with single arguments are now possible to be expanded. This will allow the call to be expanded if the line goes over budget. (#156)
  • StyLua will now firstly prefer hanging long arguments to function calls to try and fit under the width, before expanding them multiline. (#159)
  • When hanging a binary expression, previously, we would always hang the "root" node of AST BinExp tree. Now we will check to see if is necessary (we are over width) before hanging (#163)
  • StyLua will hug together table braces with function call parentheses when formatting a function call taking a single table as an argument. (#182)
  • Function calls with more than one argument, where an argument is "complex", will now expand multiline. "complex" is an argument spanning multiple lines, but excludes a table or anonymous function, as we handle them explicitly. (#183)
  • StyLua will always hang at the equals token for a multi-variable assignment. (#185)
  • Tables with multiline fields (such as an anonymous function expression) should always expand if previously on single line. (#187)
  • Function definitions (both normal and anonymous) with an empty body will now be kept on a single line. This is common for noop functions local function noop() end. (#188)

Fixed

  • Fixed 1 or 2 digit numerical escapes being incorrectly removed
  • Fixed whitespace being lost before a multiline comment. We will now preserve a single space (e.g. local test --[[foo]] = true -> local test --[[foo]] = true) (#136)
  • Fixed the double formatting of a hanging call chain when it was being assigned to a variable causing it to be incorrectly formatted (#151)
  • Fixed leading comments to a binop in a hanging expression being lost (#154)
  • Fixed mistransformation of comments leading the RHS of a hanging binop. They are now moved to before the binop (#154)
  • Fixed comments trailing unnecessary parentheses around expressions that were later removed not being preserved (#176)
  • Fixed a double unary minus (- -foo/-(-foo)) being formatted as --foo leading to a comment syntax error. Parentheses are now enforced: -(-foo) (#171)
  • Fixed semicolon being removed leading to function call x new statement ambiguity when next statement is an assignment with the first variable being a parentheses var expression (#173)
  • Fixed mistransformation of comments in if condition then or while condition do lines - improved assurance that they will hang multiline (#164)
  • Fixed indentation of comments leading a then or do token when if ... then or while ... do are multiline.
  • Fixed mistransformation of comments in a generic declaration under the luau feature flag (#166)
  • Fixed trailing comma being added after comments in multiline type table under the luau feature flag (#166)

Don't miss a new StyLua release

NewReleases is sending notifications on new releases.