Releases: JohnnyMorganz/StyLua
Releases Β· JohnnyMorganz/StyLua
v0.14.0
[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
v0.13.1
[0.13.1] - 2022-04-11
Fixed
General
- Fixed leading trivia on semicolon lost when semicolon is removed (#431)
- Fixed shape calculation of the RHS of a binary expression not correctly reset when hanging, causing it to expand unnecessarily (#432)
- Fixed unstable formatting of tables at column width boundary (#436)
- Fixed assignments no longer hanging at equals token if a comment is present, but the expression is not hangable at a binop. (#439)
Luau
- Fixed unstable formatting around comments within type declarations (#397, #430)
- Fixed parentheses around type assertions in a binary expression being removed leading to incorrect semantics. (#441)
What's Changed
- Fix semicolon leading comments lost when semicolon removed by @JohnnyMorganz in #433
- Reset RHS expression shape when hanging at binop by @JohnnyMorganz in #434
- Fix unstable formatting of tables at column width boundary by @JohnnyMorganz in #437
- Hang at equals token in assignment if expression cannot hang internally by @JohnnyMorganz in #440
- Fix unstable formatting around comments in type declarations by @JohnnyMorganz in #435
- Keep parens around type assertion if in binexp by @JohnnyMorganz in #443
Full Changelog: v0.13.0...v0.13.1
v0.13.0
NOTE: This release removes the version from the release file names (#343). If you have automated tooling to download StyLua releases, you may need to update them to exclude the version from the name
[0.13.0] - 2022-03-31
Added
General
- Added support for alternative diff outputs. You can now use
--output-format=unified
or--output-format=json
to output a unified diff or json mismatches list respectively. A unified diff can be fed into other tools such aspatch
ordelta
, whilst a JSON diff provides a more machine readable format useful for extensions. (#230)
Changed
General
- Migrate internal dependency for CLI arguments handling, with improved help messages.
- Generic fors will no longer expand onto multiple lines if the expression looping over is a function call with a single table argument (e.g.,
ipairs({ ... })
) (#405) - When hanging an assignment of an expression contained within parentheses, we do not add an extra indentation. The formatting is now consistent with expanded tables and function calls. (#274)
Luau
- Type declarations consisting of unions/intersections where an inner type has a multiline comment will now force hanging
- Excess parentheses around a type assertion will now be removed. (#383, #425)
Fixed
General
- Fixed issue through static linking where Windows binary would not execute due to missing
VCRUNTIME140.dll
. (#413) - Fixed assignment with comment sometimes not hanging leading to malformed syntax. (#416)
- Fixed block ignores not applied when multiple leading block ignore comments are present at once. (#421)
- Fixed ordering of comments when semicolon after statement is removed. (#423)
What's Changed
- Break down function argument code by @JohnnyMorganz in #408
- Migrate to clap v3 with new help messages by @JohnnyMorganz in #409
- Add support for alternative diff outputs by @JohnnyMorganz in #411
- Hang type union declarations if multiline comment is seen by @JohnnyMorganz in #402
- Hug generic for when expression is function call with single table arg by @JohnnyMorganz in #412
- Revert 1.58 format string syntax by @JohnnyMorganz in #417
- Statically link the vc runtime by @JohnnyMorganz in #418
- Remove excess parentheses around type assertions by @JohnnyMorganz in #419
- Always hang assignment if it contains comments by @JohnnyMorganz in #420
- Fix block ignore not applied when multiple comments present by @JohnnyMorganz in #422
- Fix comments ordering when semicolon removed after stmt by @JohnnyMorganz in #424
- Fix parentheses incorrectly removed around assertion when hanging by @JohnnyMorganz in #426
- Perform large scale testing by @JohnnyMorganz in #428
- Fix large scale test action by @JohnnyMorganz in #429
- Don't hang an extra level when hanging parens assignment by @JohnnyMorganz in #427
Full Changelog: v0.12.5...v0.13.0
v0.12.5
This release only affects users of the luau
feature flag
[0.12.5] - 2022-03-08
Fixed
Luau
- Fixed crashed due to unhandled generic type packs under the
luau
feature flag. (#403)
Full Changelog: v0.12.4...v0.12.5
v0.12.4
[0.12.4] - 2022-03-02
Fixed
General
- Fixed comments being lost around a condition when unnecessary parentheses are removed. (#389)
- Fixed multiline expression with comments inside parentheses being collapsed leading to a syntax error. (#386)
- Fixed ignore comments not respected in child blocks of ignored statements. (#387)
Luau
- Fixed long comments forcing unnecessary hanging of type declarations. (#384)
- Fixed long intersection types not hanging. (#382)
- Fixed values in type tables not hanging when over width. (#394)
- Fixed type info generics not hanging when over width. (#394)
- Fixed callback types with binop type parameters / return types not hanging leading to a syntax error when comments are present. (#396)
- Fixed type declarations not hanging properly causing them to go over width. This includes hanging at the equals token and hanging union/intersection types.
v0.12.3
[0.12.3] - 2022-02-17
Fixed
General
- Fixed call chains not hanging when comments were present in between calls, leading to a syntax error. (#367)
Luau
- Fixed if-expression syntax getting unnecessarily expanded further due to trailing comments. (#375)
- Fixed formatting of leading comments of a keyword in if-expression syntax. (#374)
- Fixed formatting of long type declarations which go over the line width to hang if possible. (#372)
- Fixed mistransformation of comments within a type union leading to a syntax error. (#378)
What's Changed
- Automate test case retrieval by @JohnnyMorganz in #370
- Force call chain hanging if comments present by @JohnnyMorganz in #369
- Fix mistransformation of comments within IfExpressions by @JohnnyMorganz in #376
- Fix handling of long type declarations and comments in type unions by @JohnnyMorganz in #379
Full Changelog: v0.12.2...v0.12.3
v0.12.2
This release only affects users of the luau
feature flag.
Fixed
- Fixed crash due to unhandled singleton type formatting under the
luau
feature flag. (#358) - Includes types in shape calculation for causing a generic for to go multiline under the
luau
feature flag. (#360)
What's Changed
- Fix crash from unhandled singleton types by @JohnnyMorganz in #359
- Include types in generic for shape calculation by @JohnnyMorganz in #361
Full Changelog: v0.12.1...v0.12.2
v0.12.1
[0.12.1] - 2022-02-01
Fixed
- Fixed misformatting of conditions in if-expression syntax leading to spurious whitespace under the
luau
feature flag. (#349) - Fixed incorrect shape calculation in if-expression syntax: if-expression will now go multiline when only slightly over column width (
luau
feature flag). - Fixed incorrect handling of comments at the end of a callback type's arguments under the
luau
feature flag. (#352) - Fixed mistransformation of type declaration when the type info is a union which must be multiline due to comments under the
luau
feature flag. (#351) - Fixed leading comments on a
|
symbol in a type info being lost when hanging the type under theluau
feature flag. - Fixed trailing comments of a function call being lost as parentheses are removed around a single argument when
call_parentheses
is set to notAlways
. (#356)
What's Changed
- Fix misformatting of if-expression syntax by @JohnnyMorganz in #350
- Extract out
format_contained_punctuated_multiline
by @JohnnyMorganz in #353 - Fix mistransformation of comments in callback type argument by @JohnnyMorganz in #354
- Fix mistransformation of type unions with comments by @JohnnyMorganz in #355
- Preserve trailing comments when removing parens in function call by @JohnnyMorganz in #357
Full Changelog: v0.12.0...v0.12.1
v0.12.0
[0.12.0] - 2022-01-31
Added
- Added option
call_parentheses
:
Specify whether to apply parentheses on function calls with single string or table arg. Possible options:Always
(default),NoSingleString
,NoSingleTable
,None
. (#329) - Added proper multiline hanging of generic for syntax. (#322)
- Added proper formatting for if-expression syntax under the
luau
feature flag. (#289) - Updated parser to add support for generic/variadic type packs, singleton types and default types under the
luau
feature flag.
Fixed
- Fixed generic variadics not being handled under the
luau
feature flag. (#333) - Fixed issue with comments within an assignment not being correctly handled, leading to a syntax error. (#340)
- Fixed parentheses around an IfExpression being removed, leading to incorrect semantics, under the
luau
feature flag. (#345)
Deprecated
- Option
no_call_parentheses
has been deprecated. Usecall_parentheses = "None"
instead.
What's Changed
- Add docs for pre-commit integration by @rouge8 in #328
- Add a system hook for people who don't have the rust toolchain by @IamTheFij in #331
- feat: add short option for config path by @wesleimp in #332
- Handle generic variadics by @JohnnyMorganz in #334
- Adds a new version of the hook to download releases by @IamTheFij in #336
- feat: Add more granular control over call parentheses by @shadmansaleh in #330
- Multiline formatting of generic for syntax by @JohnnyMorganz in #337
- Luau: Implement proper IfExpression formatting by @JohnnyMorganz in #335
- Handle comments inlined in assignment expression better by @JohnnyMorganz in #341
- Don't remove parentheses around an IfExpression by @JohnnyMorganz in #346
- Update full-moon version by @JohnnyMorganz in #347
New Contributors
- @wesleimp made their first contribution in #332
- @shadmansaleh made their first contribution in #330
Full Changelog: v0.11.3...v0.12.0
v0.11.3
[0.11.3] - 2022-01-01
Fixed
- Fixed comments preceding a comma within a function call or parameter list for a function definition being mistransformed leading to a syntax error. (#307)
- Fixed IfExpression having abnormal leading whitespace under the
luau
feature flag. (#315) - Fixed incorrect handling of comments in unusual places within a table causing mistransformations leading to syntax errors. (#318)
What's Changed
- Fix comments preceding commas in function call/definition syntax by @JohnnyMorganz in #310
- Fix clippy issues by @JohnnyMorganz in #320
- Fix overaddition of leading whitespace to if expression by @JohnnyMorganz in #319
- Make available as a pre-commit hook by @IamTheFij in #316
- Switch pre-commit language to Rust so pre-commit can build StyLua from source by @rouge8 in #323
- Handle comments in unusual places for tables by @JohnnyMorganz in #326
- Preserve newlines in between comments from #326 by @JohnnyMorganz in #327
New Contributors
- @IamTheFij made their first contribution in #316
- @rouge8 made their first contribution in #323
Full Changelog: v0.11.2...v0.11.3