Skip to content

Releases: JohnnyMorganz/StyLua

v0.20.0

20 Jan 12:50
Compare
Choose a tag to compare

[0.20.0] - 2024-01-20

Added

  • Introduced a new release artifact stylua-linux-x86_64-musl (#834)

Changed

  • Files excluded by git (via .gitignore or global git configuration), as well as in an .ignore file (used by ripgrep and The Silver Searcher)
    will now also be ignored by StyLua (as if they were all .styluaignore files). (#833)

Fixed

General

  • The CLI tool will now only write files if the contents differ, and not modify the file if there is no change after formatting (#827)
  • Fixed function body parentheses being placed on multiple lines unnecessarily when there are no parameters (#830)
  • Fixed directory paths w/o globs in .styluaignore not matching when using --respect-ignores (#845)

Luau

  • Fixed handling of floor division (//) syntax when only Luau command line flag is enabled
  • Fixed missing space when table is inside of Luau interpolated string expression ({{ is invalid syntax)
  • Fixed parentheses around a Luau compound type inside of a type table indexer being removed causing a syntax error (#828)

New Contributors

Full Changelog: v0.19.1...v0.20.0

v0.19.1

15 Nov 17:55
Compare
Choose a tag to compare

[0.19.1] - 2023-11-15

This release has no changes. It resolves an issue in our test suite that may affect downstream package management tooling
failing tests (#824)

v0.19.0

12 Nov 11:59
Compare
Choose a tag to compare

[0.19.0] - 2023-11-12

Added

  • Added flag --respect-ignores. By default, files explicitly passed to stylua (e.g. stylua foo.lua) will always be formatted, regardless of whether the file is ignored. Enabling this flag will consider .styluaignore or glob matches before formatting the file. (#765)
    • Note: for backwards compatibility reasons, formatting via stdin always respects ignores. This behaviour will change in the next major release

Changed

  • Updated parser crate with following changes:

    • Support Luau floor division (//)
    • Fix Luau string interpolation parsing
    • Fix Luau \z escape parsing
  • Simplified access and modification patterns for StyLua configuration. You can now access the properties directly

    • Deprecated: the old access patterns of .property() and .with_property() are now deprecated
    • Breaking Change (WASM): due to JS/TS lack of differentiation between .property / .property() implementation, the .property() functions were removed from WASM output.
  • Multiline comments before commas will now remain in place and not move to after the comma. This is to support type-assertions-via-comments that is commonly used by some language servers. (#778)

Fixed

  • Wasm build now correctly supports configuring sort requires (#818)

v0.18.2

10 Sep 17:08
Compare
Choose a tag to compare

[0.18.2] - 2023-09-10

Fixed

  • Fixed LuaJIT suffixes LL/ULL causing a panic when running in --verify mode (#750)
  • Fixed incorrect formatting of conditionals when collapse_simple_statement is enabled and the block begins with an empty line (#744)
  • Fixed formatting of dot function call chains with comment between dot and names (#747)

Full Changelog: v0.18.1...v0.18.2

v0.18.1

15 Jul 19:20
Compare
Choose a tag to compare

[0.18.1] - 2023-07-15

Fixed

Luau

  • Fixed parentheses around a single Luau type pack in a generic being removed causing syntax errors (#729)

v0.18.0

14 Jun 15:24
Compare
Choose a tag to compare

[0.18.0] - 2023-06-14

Added

  • Multiline ignores (-- stylua: ignore start / -- stylua: ignore end) will now work within table fields:
require("foo").bar {
	-- stylua: ignore start
	baz      =0, -- < not formatted
	foo   =   2, -- < not formatted
	-- stylua: ignore end
	bar        =     1234 -- < formatted
}
  • Added option "Input" to call_parentheses setting, where call parentheses are retained based on their presence in the original input code.
    Note: this setting removes all automation in determining call parentheses, and consistency is not enforced.

Changed

  • Improved heuristics around Luau type excess parentheses removal, so unnecessary parentheses around types are removed in more locations

Fixed

  • Function calls are now formatted onto multiple lines if the opening brace { of a multiline table forces one of the lines over width
  • Fixed missing option --sort-requires to enable sort requires on the command line
$ stylua --sort-requires test.lua
  • Fixed parentheses removed around Luau optional type (B?) causing syntax errors when present in an intersection A & (B?)
  • Fixed comments lost when parentheses removed around Luau types
  • Fixed race condition where if a file is passed more than once as an argument to format, then it could potentially be wiped completely (for example, if an ancestor directory is passed and recursively searched, as well as the file itself)

v0.17.1

30 Mar 15:59
Compare
Choose a tag to compare

[0.17.1] - 2023-03-30

Fixed

  • Bumped internal parser dependency which should fix parsing problems for comments with Chinese characters, and multiline string escapes
  • Fixed comments in punctuated lists for return statements or assignments being incorrectly formatted leading to syntax errors (#662)
  • Fixed line endings not being correctly formatted in multiline string literals and comments (#665)

What's Changed

New Contributors

Full Changelog: v0.17.0...v0.17.1

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