CppCXY / EmmyLuaCodeStyle

fast, powerful, and feature-rich Lua formatting and checking tool.
MIT License
140 stars 27 forks source link

[Feature request] Add trailing_comma option #57

Closed gepbird closed 2 years ago

gepbird commented 2 years ago

trailing_comma option should control how trailing commas are formatted in tables. This feature would make git diffs nicer. The values could be:

Personally I wouldn't use always value, but some people might find it useful.

CppCXY commented 2 years ago

in fact, lua allow semicolon as the end of table field. should this called 'railing_comma'?

gepbird commented 2 years ago

Hmm, that's intresting. If you want to include semicolons too maybe calling it trailing_separator (or trailing_table_separator?) would be better. And also having another option separator_style (or table_separator ) that has values comma and semicolon.

I don't insist on supporting semicolons for this, since I've only seen lua codebases that use commas.

CppCXY commented 2 years ago

ok wait one day

CppCXY commented 2 years ago

feature complete.

option table_separator_style support none/comma/semicolon

option trailing_table_separator support keep/never/always/smart