EmmyLuaCodeStyle icon indicating copy to clipboard operation
EmmyLuaCodeStyle copied to clipboard

Indentation of nested tables

Open AndreasMatthias opened this issue 2 years ago • 0 comments
trafficstars

Here are three tables that are indented like this using default settings:

aaa = { 111, {
    222, {
    333, {
    444 } } } }

bbb = { 111,
    { 222,
        { 333,
            { 444 } } } }

ccc = {
    111, {
    222, {
    333, {
    444 } } } }

It's not so easy to recognize the structure of these tables, especially of aaa and ccc.

I would have expected something more like the following:

aaa = { 111, {
            222, {
                333, {
                    444 } } } }

bbb = { 111,
        { 222,
          { 333,
            { 444 } } } }

ccc = {
    111, {
        222, {
            333, {
                444 } } } }

The rules for this indentation are:

  1. If { appears at the end of a line, then indent the next line relative to the first element of the outer group.
  2. If { starts a new line, then { shall have the same indentation as the first element of the same group.

AndreasMatthias avatar Mar 02 '23 18:03 AndreasMatthias