Releases: JohnnyMorganz/StyLua
Releases Β· JohnnyMorganz/StyLua
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
luau
feature 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
luau
parsing. (#229, #231) - Default glob now matches
**/*.luau
(as well as**/*.lua
) when theluau
flag 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 1
causing 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_HOME
and$HOME/.config
) not being looked into correctly on macOS when--search-parent-directories
is used. (#260) - Fixed incorrect indentation of multiline type specifiers for function parameters under the
luau
feature 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
luau
feature flag.
v0.10.0
[0.10.0] - 2021-07-11
Added
- Added flag
--verify
which, 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-endings
and--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 start
to disable formatting and-- stylua: ignore end
to re-enable it. The comment must be preceding a statement and disabling formatting cannot cross block scope boundaries. (#198)
Changed
- Luau type tables (
luau
feature 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
luau
feature 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
--check
when 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
luau
feature 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
--verbose
to print debug information, including finding config files and time taken to format files.
Fixed
v0.9.2
[0.9.2] - 2021-06-20
Changed
- Bumped full-moon to
0.12.1
to fix parsing bugs
Fixed
- Fixed parentheses around type assertions being classed as unnecessary and removed under the
luau
feature flag. - Fixed mistransformation of function type where arguments have comments under the
luau
feature flag. (#201) - Fixed comments in an assignment in between the equals token and the expression leading to a mistransformation. (#200)
v0.9.1
[0.9.1] - 2021-06-17
Added
- Added
--stdin-filepath
option to specify location of file being taken in from stdin. This is optional and is only used to determine where to find the configuration file. If not provided, we default to searching from current working directory. (#192)
Fixed
- Fixed empty functions with comments being incorrectly collapsed leading to syntax error. (#195)
v0.9.0
[0.9.0] - 2021-06-15
Added
- CLI will now look for
stylua.toml
and its hidden counterpart,.stylua.toml
. (#145) - Added CLI flag
--search-parent-directories
. If enabled, we will look in parent directories for a configuration file, or look in$XDG_CONFIG_HOME
or$XDG_CONFIG_HOME/stylua
. (#127, #146) - Updated full-moon: Added support for typed variadics, named function type args, and generic functions under the Luau feature flag
- Will now hang on equality operators within binary expressions, if over width.
- If a file path is explicitly provided to the CLI which doesn't end with
.lua
ending, the*.lua
glob check is skipped. (#170) - Long type unions will now hang under the
luau
feature flag. (#165) - Added option
no_call_parentheses
. Enabling this config will remove parentheses around function calls taking a single string/table as an argument. This config was added for adoption purposes. (#133)
Changed
- Long prefix expressions which are hangable and go over the line limit (e.g.
("foooo" .. "barrrrrrr" .. "bazzzzzz"):format(...)
) will now hang multiline (#139) - Changed formatting for assignments. We will now try all tactics then determine the best one. Multiple assignments will now no longer attempt to hang a single expression first - we will hang the whole punctuated list. (#157)
- Function calls with single arguments are now possible to be expanded. This will allow the call to be expanded if the line goes over budget. (#156)
- StyLua will now firstly prefer hanging long arguments to function calls to try and fit under the width, before expanding them multiline. (#159)
- When hanging a binary expression, previously, we would always hang the "root" node of AST BinExp tree. Now we will check to see if is necessary (we are over width) before hanging (#163)
- StyLua will hug together table braces with function call parentheses when formatting a function call taking a single table as an argument. (#182)
- Function calls with more than one argument, where an argument is "complex", will now expand multiline. "complex" is an argument spanning multiple lines, but excludes a table or anonymous function, as we handle them explicitly. (#183)
- StyLua will always hang at the equals token for a multi-variable assignment. (#185)
- Tables with multiline fields (such as an anonymous function expression) should always expand if previously on single line. (#187)
- Function definitions (both normal and anonymous) with an empty body will now be kept on a single line. This is common for noop functions
local function noop() end
. (#188)
Fixed
- Fixed 1 or 2 digit numerical escapes being incorrectly removed
- Fixed whitespace being lost before a multiline comment. We will now preserve a single space (e.g.
local test --[[foo]] = true
->local test --[[foo]] = true
) (#136) - Fixed the double formatting of a hanging call chain when it was being assigned to a variable causing it to be incorrectly formatted (#151)
- Fixed leading comments to a binop in a hanging expression being lost (#154)
- Fixed mistransformation of comments leading the RHS of a hanging binop. They are now moved to before the binop (#154)
- Fixed comments trailing unnecessary parentheses around expressions that were later removed not being preserved (#176)
- Fixed a double unary minus (
- -foo
/-(-foo)
) being formatted as--foo
leading to a comment syntax error. Parentheses are now enforced:-(-foo)
(#171) - Fixed semicolon being removed leading to
function call x new statement
ambiguity when next statement is an assignment with the first variable being a parentheses var expression (#173) - Fixed mistransformation of comments in
if condition then
orwhile condition do
lines - improved assurance that they will hang multiline (#164) - Fixed indentation of comments leading a
then
ordo
token whenif ... then
orwhile ... do
are multiline. - Fixed mistransformation of comments in a generic declaration under the
luau
feature flag (#166) - Fixed trailing comma being added after comments in multiline type table under the
luau
feature flag (#166)
v0.8.1
[0.8.1] - 2021-04-30
Fixed
- Fixed bug where a hanging expression inside of parentheses would lead to function arguments being incorrectly formatted with a trailing comma - leading to a syntax error