lua-mode icon indicating copy to clipboard operation
lua-mode copied to clipboard

Indent lines of closers accroding to the first closer instead of the last closer

Open xinhaoyuan opened this issue 4 years ago • 3 comments

First of all, thanks for the great work!

Consider this example:

foo(bar,
    {
       key = value
})

The last line is aligned according to the latter ), which matches the indent level of foo(. Is it possible to have an option to match using the first closer } instead? I.e. the above block becomes

foo(bar,
    {
       key = value
    })

This looks more similar with how C is indented in Emacs.

xinhaoyuan avatar Apr 18 '21 20:04 xinhaoyuan

Hi,

Yeah, I think that should be possible with another indentation customization parameter, like the ones that were added recently (lua-indent-close-paren-align and lua-indent-nested-block-content-align).

immerrr avatar Apr 21 '21 18:04 immerrr

And it would also make sense to only take the last opener into account when calculating indentation, making things like the following possible:

foo(bar, {
   key = value
})

immerrr avatar Apr 21 '21 20:04 immerrr

Please implement this. I end up just making new lines for each parentheses / brace to see where inner most block ends.

triplejam avatar Dec 17 '22 22:12 triplejam