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

If statements in multiple lines #68

Closed
FlashHit opened this issue Oct 20, 2022 · 8 comments
Closed

If statements in multiple lines #68

FlashHit opened this issue Oct 20, 2022 · 8 comments
Labels
question Further information is requested

Comments

@FlashHit
Copy link

Currently the formatter would do it like this:

if s_whatevercheck and
    s_whatevercheck2 and
    s_whatevercheck3 then
    s_whatevervar = false
end

instead I would prefer sth like this:

if s_whatevercheck and
s_whatevercheck2 and
s_whatevercheck3 then
    s_whatevervar = false
end

I just want to see where the if statement ends in a better way. Let me know what you think or if you have a better suggestion.

@CppCXY
Copy link
Owner

CppCXY commented Oct 20, 2022

set this option if_condition_align_with_each_other = true

@CppCXY
Copy link
Owner

CppCXY commented Oct 20, 2022

I think this is a good choice

if  s_whatevercheck
and s_whatevercheck2
and s_whatevercheck3 then
    s_whatevervar = false
end

if option if_condition_align_with_each_other is true, you can also choose to format as above.
Or

if     s_whatevercheck
and    s_whatevercheck2
and    s_whatevercheck3 then
    s_whatevervar = false
elseif s_aaaaaaa == b then

end

@FlashHit
Copy link
Author

I think this is a good choice

if  s_whatevercheck
and s_whatevercheck2
and s_whatevercheck3 then
    s_whatevervar = false
end

if option if_condition_align_with_each_other is true, you can also choose to format as above. Or

if     s_whatevercheck
and    s_whatevercheck2
and    s_whatevercheck3 then
    s_whatevervar = false
elseif s_aaaaaaa == b then

end

I like the first one.
I am not a fan of the alignment stuff, so that’s not what I am looking for. But if the first approach could be implemented I would be glad.

@CppCXY CppCXY added the question Further information is requested label Oct 20, 2022
@CppCXY
Copy link
Owner

CppCXY commented Oct 20, 2022

I mean that's what the existing option does, it's not the planning option

@FlashHit
Copy link
Author

well the issue is that it also adds more spaces, which I don't like.
grafik

so instead of this:

if s_whatevercheck
    and s_whatevercheck2
    and s_whatevercheck3 then
    s_whatevervar = false
end

or this:

if  s_whatevercheck
and s_whatevercheck2
and s_whatevercheck3 then
    s_whatevervar = false
end

if want this:

if s_whatevercheck
and s_whatevercheck2
and s_whatevercheck3 then
    s_whatevervar = false
end

@CppCXY
Copy link
Owner

CppCXY commented Nov 15, 2022

The preset options are not what you would like,then wait for my refactoring, or you modify my code

@CppCXY
Copy link
Owner

CppCXY commented Nov 15, 2022

ok, I forget, the option if_condition_no_continuation_indent=true may help, and remove option if_condition_align_with_each_other=true

@FlashHit
Copy link
Author

Yes, this is what I searched 👍

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

No branches or pull requests

2 participants