StyLua
StyLua copied to clipboard
An opinionated Lua code formatter
Stylua 0.20.0. I wish I had a minimum repro but the very obvious repros aren't triggering it I'm afraid so the block of code is longer. Why it matters: we...
before: ```lua build(): -- comment init():start() ``` after: ```lua build()(): -- commentinit():start() ``` `--verify` ``` error: could not format file ./stylua.lua: INTERNAL ERROR: Output AST generated a syntax error. Please...
Environment: - Node.js: v24.2.0 - Package: @johnnymorganz/stylua (latest) - Module type: ESM ("type": "module") - Build tool: tsup with format: ["esm"] What's happening: I'm getting a build error because stylua_lib.js...
Closes #986
E.g. ``` hzj_jie@hzj-jie-x61t - Mon May 12-23:42:21:~/git/koreader-202411$ cat test.lua local function f() local a = "ab" a = a:gsub("a".. -- " 'b', function() return "c" end) print(a) end f() ```...
In a project I work on, this is how the code was originally formatted ```luau local Dictionary: {[string]: number} -- comment = { ["A"] = 1 ["B"] =2, ["C"] =...
You have to explicitly use blocks with `start` and `end`
Currently we have to have sort-requires off as we override the `require` global. The following gets sorted incorrectly: ```luau local require = require(ReplicatedStorage:WaitForChild("Sonar")) local DisplayUtils = require("DisplayUtils") local Maid =...
```lua local foo = { [([==[bar]==])] = true, [([=[bar]=])] = true, [([[bar]])] = true, } foo[([==[bar]==])] = true foo[([=[bar]=])] = true foo[([[bar]])] = true ``` will be converted to error...
Most commonly seen in the VS Code color picker, a value will be represented as X.000000 (give or take); and stylua does not strip these redundant values.