Ruin0x11 / OpenNefia

(Archived) Moddable engine reimplementation of the Japanese roguelike Elona.
MIT License
116 stars 18 forks source link

Format the codebase consistently #331

Open Ruin0x11 opened 3 years ago

Ruin0x11 commented 3 years ago

Right now everything is formatted ad-hoc by lua-mode at 3-column indentation. But until recently I didn't know of any Lua code formatter that works consistently enough.

Thankfully someone has finally done all the boring and painful work of writing a Lua code formatter that actually works, called StyLua.

For most of the codebase, the actual changes after formatting are rather minimal. There are only two things that I'd configure for it:

  1. Ability to preserve table constructor call syntax for single-argument function calls (for data:add {}).
  2. Automatically hanging method chains when the first expression in the chain is a string constant wrapped in parentheses (for use inside locale/).