Alloyed / lua-lsp

A Lua language server
MIT License
288 stars 21 forks source link

There is no standard lua formatter #2

Open Alloyed opened 7 years ago

Alloyed commented 7 years ago

:thinking:

I'm not willing to write my own but it's interesting that it doesn't exist to begin with prior art: https://github.com/trixnz/lua-fmt written by the vscode server author https://github.com/trixnz/vscode-lua

ryanplusplus commented 7 years ago

Most formatters I've encountered have used the Metalua-based formatter:

I've never found the upstream source for this formatter, but I haven't searched a whole lot. As far as I can tell the source is just copy-pasted around.

Although widely used, this formatter does choke on Lua 5.3's new bitwise operators because it's based on Lua 5.1.

Alloyed commented 7 years ago

Thanks, the parser I'm using implements a subset of metalua so I can probably just retrofit this onto its output.

the EPL suggest that it started in eclipse, and it even includes a CLI interface (!) I might leave that in there so if somebody just wants a standalone formatter they can install my package and call it from there

ryanplusplus commented 7 years ago

:+1:

shuxiao9058 commented 5 years ago

https://github.com/Koihik/LuaFormatter

Alloyed commented 5 years ago

https://github.com/trixnz/lua-fmt

lblasc commented 3 years ago

https://github.com/JohnnyMorganz/StyLua