Releases: JohnnyMorganz/StyLua
Releases · JohnnyMorganz/StyLua
v0.12.2
This release only affects users of the luau feature flag.
Fixed
- Fixed crash due to unhandled singleton type formatting under the
luaufeature flag. (#358) - Includes types in shape calculation for causing a generic for to go multiline under the
luaufeature 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
luaufeature flag. (#349) - Fixed incorrect shape calculation in if-expression syntax: if-expression will now go multiline when only slightly over column width (
luaufeature flag). - Fixed incorrect handling of comments at the end of a callback type's arguments under the
luaufeature flag. (#352) - Fixed mistransformation of type declaration when the type info is a union which must be multiline due to comments under the
luaufeature flag. (#351) - Fixed leading comments on a
|symbol in a type info being lost when hanging the type under theluaufeature flag. - Fixed trailing comments of a function call being lost as parentheses are removed around a single argument when
call_parenthesesis set to notAlways. (#356)
What's Changed
- Fix misformatting of if-expression syntax by @JohnnyMorganz in #350
- Extract out
format_contained_punctuated_multilineby @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
luaufeature flag. (#289) - Updated parser to add support for generic/variadic type packs, singleton types and default types under the
luaufeature flag.
Fixed
- Fixed generic variadics not being handled under the
luaufeature 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
luaufeature flag. (#345)
Deprecated
- Option
no_call_parentheseshas 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
luaufeature 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
v0.11.2
[0.11.2] - 2021-11-15
Fixed
- Fixed spaces around brackets string (
[[string]]) used as an index or table key (i.e.[ [[string]] ]) being removed, leading to a syntax error. (#293) - Fixed incorrect shape calculation leading to arguments incorrectly expanding when under column width. (#298)
- Fixed incorrect shape calculation for singleline table at the column width boundary. (#296)
- Fixed IfExpression syntax containing extra/abnormal trailing whitespace when currently formatting as-is under the
luaufeature flag. (#297) - Fixed newlines before arguments in a function call which is later formatted on a single line being preserved, leading to inconsistent formatting. (#290)
- Fixed odd formatting when returning multiple tables or functions only. (#302)
- Fixed comments within an index expression (
foo[index]) incorrectly handled leading to malformed formatting. (#304)
v0.11.1
[0.11.1] - 2021-11-08
Changed
- Updated internal parser to fix parsing issues and update
luauparsing. (#229, #231) - Default glob now matches
**/*.luau(as well as**/*.lua) when theluauflag is enabled. (#291)
Fixed
- Fixed indentation of type callback specifier parameters when parameters have leading comment trivia. (#278)
- Fixed trailing comma not being taken into account when determining the width of a field in a multiline table. (#282)
- Fixed
--num-threads 1causing a deadlock. (#281) - Fixed whitespace around parts of a binary expression causing it to over-hang in first pass, leading to unstable formatting. (#287)
v0.11.0
[0.11.0] - 2021-09-16
Changed
- In Luau type tables, a newline after the opening brace will now force the type table multiline. This is the same procedure as standard tables. (#226)
- In Luau, type specifiers for function parameters will now force the parameters to be formatted multiline if a specifier is multiline (and there is more than one parameter).
- Improved error messages to make them easier to understand.
Fixed
- Fixed range formatting no longer working when setting the range to statements inside nested blocks. (#239)
- Fixed ignore file present in cwd not taken into account if cwd not included in file paths to format. (#249)
- Fixed config locations (
$XDG_CONFIG_HOMEand$HOME/.config) not being looked into correctly on macOS when--search-parent-directoriesis used. (#260) - Fixed incorrect indentation of multiline type specifiers for function parameters under the
luaufeature flag. (#256) - Fixed unstable formatting caused by a singleline table which just reaches the column width. (#261)
- Fixed misformatting of a binop expression as precedence of the RHS expression was not taken into account. (#257, #261)
v0.10.1
[0.10.1] - 2021-08-08
Fixed
- Fixed an incorrect trailing comma being added to function args as part of a multiline expression list leading to a syntax error. (#227)
- Fixed the first expression in a multiple assignment prematurely hanging even if its below the column width. (#233)
- Updated internal parser to fix parsing issues for Luau code under the
luaufeature flag.
v0.10.0
[0.10.0] - 2021-07-11
Added
- Added flag
--verifywhich, when enabled, attempts to verify the generated output AST with the input AST to detect any changes to code correctness. Useful for adopting StyLua into a large codebase, at the cost of slower processing. (#199) - Added optional command line options
--column-width,--indent-type,--indent-width,--line-endingsand--quote-style, which, when provided, will override any configuration setting inferred from the default or astylua.toml. (#213) - Added multithreaded support for formatting file in the CLI. Now each file will be formatted in its own thread. The number of threads used defaults to the number of cores on your computer, but can be set using
--num-threads - Added support for disabling formatting over specific ranges. Use
-- stylua: ignore startto disable formatting and-- stylua: ignore endto re-enable it. The comment must be preceding a statement and disabling formatting cannot cross block scope boundaries. (#198)
Changed
- Luau type tables (
luaufeature flag) now use the same formatting strategy as normal expression tables, so that their formatting is more aligned. - Luau typings now have improved checking against the current shape width to determine how to format if over column width.
- Luau callback types will now format multiline if they become over width under the
luaufeature flag. - Improved the formatting of return expressions, they are now more in line with assignment expressions. (#194)
- Changed buffering of error messages in the CLI. Originally, they would be buffered till the end, but now they are output immediately when seen.
- Allowed the use of
--checkwhen taking input from stdin. - An error when parsing provided globs will cause the program to immediately exit rather than continuing with the incorrect glob.
- Only diff errors will exit with a status code of
1. Other errors (e.g. parse errors or internal errors) will now exit with status code of2.
Fixed
- Fixed comments inside Luau type tables leading to malformed formatting under the
luaufeature flag. (#219) - Fixed multiple assignment where an expression was originally hung due to comments being collapsed leading to malformed formatting. (#222)
- Fixed an issue where a function call with a single table argument being hugged with the parentheses which contain comments leading to a syntax error. (#224)
v0.9.3
[0.9.3] - 2021-06-26
Added
- Added
--verboseto print debug information, including finding config files and time taken to format files.