Releases: JohnnyMorganz/StyLua
v0.17.0
[0.17.0] - 2023-03-11
Added
- Added support for "sort requires", which sorts top-level statements of the form
local NAME = require(EXPR)
lexicographically onNAME
.
We do this by treating a group of consecutive requires as a "block", and then sorting only within the block. Any other statement, or an empty line, between require statements will split the group into two separate blocks (and can be used to separate the sorting). A block of requires will not move around the file.
Roblox Luau statements of the formlocal NAME = game:GetService(EXPR)
will also be sorted separately.
This feature is disabled by default. To enable it, add the following to your stylua.toml
:
[sort_requires]
enabled = true
Note: we assume that all requires are pure with no side effects. It is not recommended to use this feature if the ordering of your requires matter.
- Added support for EditorConfig, which is taken into account only if no
stylua.toml
was found.
This feature is enabled by default, it can be disabled using --no-editorconfig
.
- Published StyLua to the Docker Hub
What's Changed
- Sort requires by @JohnnyMorganz in #653
- Add default
editorconfig
feature by @LEI in #645 - extension: Pass cwd as workspace folder for version check by @JohnnyMorganz in #659
- Add Dockerfile by @eberkund in #655
New Contributors
Full Changelog: v0.16.1...v0.17.0
v0.16.1
[0.16.1] - 2023-02-10
Fixed
General
- Fixed mistransformation of a function argument in a multilined function call when the argument contains a comment, causing a syntax error. We now attempt to hang the expression (#648)
Luau
- Fixed verify AST flagging a false positive for parentheses removed around a Luau type (#643)
Full Changelog: v0.16.0...v0.16.1
v0.16.0
[0.16.0] - 2023-01-15
Added
Luau
- Unnecessary parentheses around Luau types will now be removed (#611)
Lua 5.2 / Lua 5.3 / Lua 5.4
- Collapse a body containing only a
goto
statement whencollapse_simple_statement
is set (#618)
Changed
General
- Update internal parser:
- Several optimisations applied to formatting functions to reduce time taken. Files which previously did not terminate (6MB+) now finish in reasonable time. (#591)
- Assignments of the form
local name = function
will no longer hang at the equals token, and instead force parameters multiline, to reduce unnecessary indentation. (#595)
Fixed
General
- Fixed an anonymous function assignment
local x = function()
being unnecessarily indented if the function body contains a comment (#627) - Fixed malformed formatting when there is a newline between a
return
token and the expressions (#605) - Fixed malformed formatting of multi-assignment or multi-returns where there is a comment within the expressions list (#637)
Full Changelog: v0.15.3...v0.16.0
v0.15.3
[0.15.3] - 2022-12-07
Fixed
General
- Fixed necessary parentheses removed in
(-X) ^ Y
causing change in semantics (#623) - Take into account
function
token size when formatting an anonymous functionfunction() end
(particularly relevant when collapsing simple statements) (#619)
Luau
- Support hanging inside of Luau type arrays
{ T }
to fix formatting issues when comments are present (#617)
Full Changelog: v0.15.2...v0.15.3
v0.15.2
[0.15.2] - 2022-10-31
Fixed
- Fix incorrect indentation level used for hanging expressions in if expression syntax (#596)
- Fixed Luau return type in parentheses containing a comment on the last item being collapsed causing a syntax error (#608)
- Fix parentheses removed which highlight precedence in
(not X) == Y
causing linting errors (#609) - Fix build script for
@johnnymorganz/stylua
to include all lua and luau features (#614)
What's Changed
- Update readme (collapse_simple_statement) by @uga-rosa in #590
- Add default collapse_simple_statement to README.md by @kawarimidoll in #598
- Add
serialize
,fromstr
andwasm-bindgen
features by @RubixDev in #592 - Add hang level to hanging if expression by @JohnnyMorganz in #599
- Don't collapse when comment present in typeinfo tuple by @JohnnyMorganz in #612
- Don't remove excess parentheses which are highlighting precedence by @JohnnyMorganz in #610
- fix: 614 support all features in wasm by @ktrz in #615
New Contributors
- @uga-rosa made their first contribution in #590
- @RubixDev made their first contribution in #592
- @kawarimidoll made their first contribution in #598
- @ktrz made their first contribution in #615
Full Changelog: v0.15.1...v0.15.2
v0.15.1
v0.15.0
This release introduces support for Lua 5.3 and Lua 5.4!
When compiling/installing with cargo, pass --features lua53
or --features lua54
respectively. By default, the GitHub Releases build with Lua 5.3 and 5.4 enabled (but note issues such as #407)
Changes to GitHub Release Artifacts
This release changes the naming for binary artifacts. We now append the arch to the end of all artifacts
stylua-win64.zip
->stylua-windows-x86_64.zip
stylua-macos.zip
->stylua-macos-x86_64.zip
stylua-linux.zip
->stylua-linux-x86_64.zip
Linux aarch64 is also now supported, alongside macOS aarch64.
The old artifact naming is kept temporarily for backwards compatibility. We recommend any references to be changed, as these artifacts will no longer be produced in future versions.
[0.15.0] - 2022-09-21
Added
- Added support for Lua 5.3, gated behind the
lua53
feature flag (#534) - Added support for Lua 5.4, gated behind the
lua54
feature flag (#533) - Added
--allow-hidden
flag to allow entering and formatting hidden files/directories (#562) - Added
--output-format=summary
which can be used with--check
to output a summary of the list of files not correctly formatted (#573)
Changed
Fixed
- Precommit hook now supports downloading aarch64 binary for M1 macs (#558)
- Fixed mistransformations of generic for loop with comments in the expression list (#579)
- Fixed
then
/else
token not taken into account when formatting an if-expression (#582) - Fixed macos-aarch64 artifact for real
What's Changed
- Enforce locked on cargo publish by @JohnnyMorganz in #557
- Update pyproject to support installing on M1 machines by @IamTheFij in #558
- feat: add
--allow-hidden
option by @wincent in #563 - Allow alternative way to compute large scale diffs by @JohnnyMorganz in #564
- Don't expand call with nested comment by @JohnnyMorganz in #549
- Update external test cases by @github-actions in #521
- Add search parent dirs config for VSCode extension by @filiptibell in #568
- Fix release build target by @JohnnyMorganz in #569
- Improve comments within function calls by @JohnnyMorganz in #566
- Rename release targets and add linux-aarch64 by @IamTheFij in #559
- Fix aarch64 linux builds by @IamTheFij in #572
- Add
--output-format=summary
by @JohnnyMorganz in #575 - Fix mistransformation of generic for comments by @JohnnyMorganz in #580
- Update external test cases by @github-actions in #578
- Consider multiline comment when inlining function call by @JohnnyMorganz in #581
- Take into account token width for if expression formatting by @JohnnyMorganz in #583
- Add Lua 5.3 and 5.4 support with full-moon update by @JohnnyMorganz in #576
New Contributors
- @wincent made their first contribution in #563
- @filiptibell made their first contribution in #568
Full Changelog: v0.14.3...v0.15.0
v0.14.3
[0.14.3] - 2022-08-27
Fixed
General
- Fixed macOS aarch64 target in release workflow (#528)
- Fixed leading comments lost from an expression when excessive parentheses are removed from it (#530)
- Fixed comments present in a complex expression not forcing multiline hanging leading to a syntax error (#524)
- Take into account the extra line created when hanging at equals token in an assignment. This should prevent unnecessary hanging (#542)
- Fixed comments added to a newly created trailing comment not being formatted (#547)
- Fixed call chain with a small prefix not being kept inlined causing unstable formatting (#514)
- Fixed shape computation for table fields causing unnecessary expansion (#551)
- Fixed hanging the prefix string in
("str"):call
unnecessarily when it provides no benefit (#508) - Fixed table field value being expanded when it could be hanged instead (#541)
Luau
- Long union/interesection types inside of a parentheses will now cause the parentheses to expand multiline (#531)
- Fixed unnecessary break on
else
in an if-expression when the expression contains a comment (#520)
What's Changed
- Expand regression test suite by @JohnnyMorganz in #523
- Fix aarch64 target by @mvllow in #529
- Add changelog links by @LastTalon in #532
- Format type parentheses multiline if long union/intersection by @JohnnyMorganz in #536
- Keep leading comments when removing excess parentheses by @JohnnyMorganz in #537
- Fix collapsing when comment present in complex expr by @JohnnyMorganz in #538
- Remove unnecessary else break in if expression comments by @JohnnyMorganz in #539
- Create
@johnnymorganz/stylua-bin
installable through npm by @JohnnyMorganz in #540 - Take into account extra line when hanging assignment by @JohnnyMorganz in #544
- Temporarily disable BlizzardInterfaceCode in LST by @JohnnyMorganz in #546
- Format comments added to new trailing comma by @JohnnyMorganz in #548
- Keep small prefix inlined in call chain by @JohnnyMorganz in #550
- Fix table field shape calculation by @JohnnyMorganz in #552
- Don't attempt to hang a prefix string unnecessarily by @JohnnyMorganz in #545
- Prefer hanging table field value over expanding by @JohnnyMorganz in #553
New Contributors
Full Changelog: v0.14.2...v0.14.3
v0.14.2
[0.14.2] - 2022-07-27
Fixed
- Fixed var expression with trailing comments on initial prefix being collapsed leading to malformed formatting (#509)
- Fixed return with comment between return and expression being collapsed leading to malformed formatting (#504)
- Fixed release assets for precommit by marking release artifacts as application/zip (#496)
What's Changed
- Set content type of release assets to zip by @JohnnyMorganz in #510
- Fix collapsing when varexpr prefix has trailing comments by @JohnnyMorganz in #511
- Fix collapsing when comment between return and expr by @JohnnyMorganz in #513
Full Changelog: v0.14.1...v0.14.2
v0.14.1
[0.14.1] - 2022-07-21
Changed
- Chained var expression formatting will now follow the exact same steps as chained function call formatting
Fixed
- Fixed var expression with comments collapsing leading to malformed formatting (#500)
- Fixed ignore behavior for
--stdin-filepath
(#495)
What's Changed
- Fix README typo by @Wyatt-Stanke in #498
- Fix clippy warnings by @JohnnyMorganz in #501
- Fix var expression collapsing when containing comments by @JohnnyMorganz in #502
- Fix ignore behavior for --stdin-filepath by @MunifTanjim in #495
New Contributors
- @Wyatt-Stanke made their first contribution in #498
- @MunifTanjim made their first contribution in #495
Full Changelog: v0.14.0...v0.14.1