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

never seems to indent anonymous functions properly when used as pars to another function (higher order function) #19

Open
RichardEllicott opened this issue Jul 21, 2018 · 1 comment

Comments

@RichardEllicott
Copy link

it can NEVER seem to handle anonymous functions like:

if pcall(function ()
print('test1')
error()
end)then
print('test2')
else
print('test3')
end

this is how lua format will make this look, making all the subsequent nesting screw up:

https://gist.github.com/Ri…/ceb10fd1ed1ce1691756bda96699342a

thank god this actually formats okay mind:

tableOhFunctions = {
thingy1 = function ()
print('blah')
end,
thingy2 = function ()
print('blah')
end,
}

so long as i make sure them "end" statements go on the next lines

However, since "pcall" with an anonymous function is lua's equivalent to try and catch, this is driving me crazy!

@floydawong
Copy link
Owner

First of all, I'm sorry for not replying you in time because I have been too busy recently.
Thank you for providing me with the test code.
This plugin is optimized for code placement and doesn't intelligently recognize code blocks, such as anonymous functions.
I've been thinking about how to make it smarter.
Maybe I'll rewrite it in a different way.
:)

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

2 participants