Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
xinhaoyuan opened this issue Apr 18, 2021 · 3 comments

Comments

@xinhaoyuan
Copy link

xinhaoyuan commented Apr 18, 2021

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.

@immerrr
Copy link
Owner

immerrr commented Apr 21, 2021

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
Copy link
Owner

immerrr commented Apr 21, 2021

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
})

@triplejam
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants