github JohnnyMorganz/StyLua v0.14.0

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

[0.14.0] - 2022-07-06

Added

  • --output-format=json now outputs all (error) messages in JSON format (#453)
  • Added WASM build support. Stylua is available on npm for consumption in Node.js or a browser (using a bundler) - https://www.npmjs.com/package/@johnnymorganz/stylua
  • Ignore comments will now be respected before fields inside tables (#448)
  • Stylua library (stylua_lib) now exposes a format_ast(ast, config, range, verification) function to format a full-moon AST directly (#482)
  • Added collapse_simple_statement option. It can take the values Never (default), FunctionOnly, ConditionalOnly or Always. When enabled, "simple" functions or if statements (ones where they only return a value or have a simple statement such as a function call) will be collapsed onto a single line where possible.

Changed

  • We now attempt to first hang the equals token in an assignment before expanding the RHS expression, provided the expression is not "complex" (#292, #489)
  • We now use the current indent level of comments preceding an elseif/else token to determine whether they should still be indented one level or inlined with the elseif/else token. (#254)
  • Static chained function calls (i.e., foo.bar().baz()) will now hang if necessary (#368)
  • The first call in a chained function call will now inline with the prefix if the prefix begins with an uppercase letter or the prefix is smaller (in length) than the indent width
  • A chained function call will not expand if the first call gets inlined and there is only 2 calls

Fixed

  • [Luau] Fixed spacing lost before a comment within a type generic (#446)
  • [Luau] Removed unnecessary expansion of a type generic with a single table as the parameter (#442)
  • Fixed incorrect extra indentation of an expanded parentheses passed as a function call argument (#456)
  • [Luau] Increased the shape size of the expression in a type assertion so that it will correctly hang if over width (#466)
  • Fixed binary expression in a table field containing a comment being collapsed leading to malformed formatted (#471)
  • Fixed end parentheses of a function call with a multiline comment internally being expanded onto a new line unnecessarily (#473)
  • Fixed severe performance regression with complex nested function calls (#477)

What's Changed

New Contributors

Full Changelog: v0.13.1...v0.14.0

Don't miss a new StyLua release

NewReleases is sending notifications on new releases.