Skip to content

Releases: JohnnyMorganz/StyLua

v0.17.0

11 Mar 16:54
Compare
Choose a tag to compare

[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 on NAME.
    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 form local 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.


What's Changed

New Contributors

Full Changelog: v0.16.1...v0.17.0

v0.16.1

10 Feb 22:06
Compare
Choose a tag to compare

[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

15 Jan 12:28
Compare
Choose a tag to compare

[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 when collapse_simple_statement is set (#618)

Changed

General

  • Update internal parser:
    • (lua52) Support Lua 5.2 fractional hexidecimal / hexidecimal with exponents (#621)
    • (lua52) Support LuaJIT number suffixes LL/ULL/i (#621)
    • (lua52) Support \z escape sequences in strings (#613)
    • (luau) Support Luau string interpolation (#607)
  • 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

07 Dec 15:36
Compare
Choose a tag to compare

[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 function function() 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

31 Oct 10:38
Compare
Choose a tag to compare

[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

New Contributors

Full Changelog: v0.15.1...v0.15.2

v0.15.1

22 Sep 15:52
Compare
Choose a tag to compare

[0.15.1] - 2022-09-22

Fixed

  • Updated parser to fix comments and string parsing issues (#585, #587)

v0.15.0

21 Sep 17:52
Compare
Choose a tag to compare

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

  • We will no longer expand function calls when it contains an inlined multiline comment (#543, #561)

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

New Contributors

Full Changelog: v0.14.3...v0.15.0

v0.14.3

27 Aug 10:59
Compare
Choose a tag to compare

[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

New Contributors

Full Changelog: v0.14.2...v0.14.3

v0.14.2

27 Jul 21:00
Compare
Choose a tag to compare

[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

Full Changelog: v0.14.1...v0.14.2

v0.14.1

21 Jul 21:43
Compare
Choose a tag to compare

[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

New Contributors

Full Changelog: v0.14.0...v0.14.1