[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 aformat_ast(ast, config, range, verification)
function to format a full-moon AST directly (#482) - Added
collapse_simple_statement
option. It can take the valuesNever
(default),FunctionOnly
,ConditionalOnly
orAlways
. 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 theelseif
/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
- Build release on Ubuntu 18 by @stopdropandrew in #445
- Type generics comment spacing by @JohnnyMorganz in #449
- Hug single table in type generic by @JohnnyMorganz in #450
- Fix some typos by @mhmdanas in #451
- Remove extraneous whitespace by @mhmdanas in #452
- Create JSON-compatible errors by @JohnnyMorganz in #455
- Fix extra indent of expanded parens inside function call by @JohnnyMorganz in #457
- Simplify trivia updater macros by @JohnnyMorganz in #458
- Force shape increment LHS value in type assertion by @JohnnyMorganz in #467
- Add wasm build support by @JohnnyMorganz in #468
- Allow ignore comments before table fields by @JohnnyMorganz in #469
- Fix syntax error field binexp w/ comment collapsed by @JohnnyMorganz in #472
- Fix call parens unnecessarily expanded new line by @JohnnyMorganz in #474
- Add
stylua.disableVersionCheck
by @JohnnyMorganz in #475 - Fix severe perf regression of complex nested function calls by @JohnnyMorganz in #478
- Hang assignment at equal token before expanding RHS by @JohnnyMorganz in #342
- Fix comment indentation on elseif/else token by @JohnnyMorganz in #480
- Workflow testing by @JohnnyMorganz in #481
- Expose
format_ast
functionality by @JohnnyMorganz in #483 - Hang static chained function calls by @JohnnyMorganz in #470
- Use initial comment indentation level for elseif/else comments by @JohnnyMorganz in #488
- Simplify "simple heuristics" even further by @JohnnyMorganz in #492
- Prevent hanging on equals token for complex expression by @JohnnyMorganz in #491
- Collapse simple statements onto single line, behind option by @JohnnyMorganz in #479
New Contributors
Full Changelog: v0.13.1...v0.14.0