Releases · JohnnyMorganz/StyLua
v2.1.0 [2.1.0] - 2025-04-21 Added@native
/ @deprecated
) on functionssyntax = "cfxlua"
(#855)stylua-linux-aarch64-musl.zip
::
and generics >>
) (#960 / #962)ubuntu-22.04
workers due to GitHub's deprecation of ubuntu-20.04
. This may mean the pre-built release artifacts published to GitHub no longer work on ubuntu-20.04
and require a manual build.(expr :: assertion) < foo
when multilining the expression, leading to a syntax error (#940)--respect-ignores
is enabled (#969)--check
error message by @eitamal in #949--respect-ignores --stdin-filepath
on external path to cwd by @phanen in #969Full Changelog: v2.0.2...v2.1.0
v2.0.2 [2.0.2] - 2024-12-07 Fixed--stdin-filepath
is provided (#928)stylua.toml
file (#925)Full Changelog: v2.0.0...v2.0.1
v2.0.0StyLua has officially stabilised to v2.0.0. With this, we make a commitment that the formatting output is fairly stable across minor version bumps. More details: #459
Key ChangesThis release updates the internal Lua parser, bringing performance improvements and new Luau syntax features.
LuaJIT is now separate from Lua5.2, with its own feature flag.
Runtime syntax selectionBy default, StyLua runs with a parser that is able to handle a variety of different Lua syntaxes at once, with a goal of being easily usable on different codebases. However, there are times where 2 different syntax definitions conflict, introducing ambiguity. For example, Lua 5.2 label syntax (::label::
) conflicts with Luau's type assertion syntax (x :: number
), and the latter ends up taking priority.
Now, you can select a particular style of syntax at runtime to deal with these ambiguities.
In your stylua.toml
file, add:
syntax = "Lua52" # Possible values: All, Lua51, Lua52, Lua53, Lua54, LuaJIT, Luau
Or, specify --syntax lua52
on the command line.
The default remains "All" to handle all syntaxes as much as possible.
More details: #407
Updated Configuration ResolutionPreviously, StyLua would only search for a stylua.toml
(or .stylua.toml
) file in the directory where the binary was executed - the current working directory (or its ancestors, if --search-parent-directories
is enabled). This means that any configuration files present in subdirectories are not taken into account.
This release changes config resolution to pick up stylua.toml
files in subdirectories. Now, a file will format based on the stylua.toml
configuration closest to its location. StyLua will search backwards from the file location to the current working directory for a configuration file. By default, searching will stop at the current working directory, however it will continue if --search-parent-directories
is enabled.
More details: #916
[2.0.0] - 2024-11-17 Breaking Changesstylua-win64.zip
, stylua-linux.zip
and stylua-macos.zip
are no longer produced in GitHub releases, in favour of more specific names (e.g., stylua-windows-x86_64
, stylua-linux-x86_64
and stylua-macos-x86_64
).--stdin-filepath
no longer respects ignore files by default, in line with passing files directly to the command line. Now, stylua --stdin-filepath foo.lua -
will still format the stdin even if foo.lua
was in a .styluaignore
file. Use --respect-ignores
to preserve the original behaviour.Config
struct in stylua Rust librarysyntax
to help handle ambiguous syntax. By default, StyLua builds and runs with a parser to handle all Lua versions. However, the syntax of some Lua versions conflict with eachother: most notably, Lua 5.2+ goto label syntax ::label::
and Luau type assertion operator ::
. This option allows choosing what syntax to parse, to handle these conflicts. (#407)space_after_function_names
to specify whether to include a space between a function name and parentheses (#839).stylua.toml
config resolution now supports looking up config files next to files being formatted, recursively going--search-parent-directories
was specified)../src/test.lua
, executing stylua src/
will look for ./src/stylua.toml
and then ./stylua.toml
.collapse_simple_statement
is enabled, if the enclosing block is a return, we will check if the return expression is "simple" (currently, not containing a function definition) (#898):
and the function name (#890)--verify
panicing due to overflow for very large Hex numbers (#875, #889)--stdin-filepath
, use --respect-ignores
by @JohnnyMorganz in #912Config
struct by @JohnnyMorganz in #922Full Changelog: v0.20.0...v2.0.0
v0.20.0 [0.20.0] - 2024-01-20 Addedstylua-linux-x86_64-musl
(#834).gitignore
or global git configuration), as well as in an .ignore
file (used by ripgrep and The Silver Searcher).styluaignore
files). (#833).styluaignore
not matching when using --respect-ignores
(#845)//
) syntax when only Luau command line flag is enabled{{
is invalid syntax)Full Changelog: v0.19.1...v0.20.0
v0.19.1 [0.19.1] - 2023-11-15This release has no changes. It resolves an issue in our test suite that may affect downstream package management tooling
failing tests (#824)
--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)
Updated parser crate with following changes:
//
)\z
escape parsingSimplified access and modification patterns for StyLua configuration. You can now access the properties directly
.property()
and .with_property()
are now deprecated.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)
LL
/ULL
causing a panic when running in --verify
mode (#750)collapse_simple_statement
is enabled and the block begins with an empty line (#744)Full Changelog: v0.18.1...v0.18.2
v0.18.1 [0.18.1] - 2023-07-15 Fixed Luau-- 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 }
"Input"
to call_parentheses
setting, where call parentheses are retained based on their presence in the original input code.{
of a multiline table forces one of the lines over width--sort-requires
to enable sort requires on the command line$ stylua --sort-requires test.lua
(B?)
causing syntax errors when present in an intersection A & (B?)
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4