dansanderson / picotool

Tools and Python libraries for manipulating Pico-8 game files. http://www.lexaloffle.com/pico-8.php
MIT License
376 stars 45 forks source link

luafmt over-indents nested tables #93

Open GiovanH opened 3 years ago

GiovanH commented 3 years ago

Input:

local a_complex_table = {
  1, 2, {
  'a', 'b', 'c'
}}

add(a({{{{
  1
}}}}))

Command: p8tool luafmt carts/untitled_3.p8 --indentwidth 2

Expected output: no change

Actual output:

local a_complex_table = {
  1, 2, {
    'a', 'b', 'c'
  }}

add(a({{{{
            1
          }}}}))

Luafmt seems to be indenting to the inner width rather than the outer width, and so is over-spacing tables. This likely applies to non-table nested structures as well.