-
Notifications
You must be signed in to change notification settings - Fork 565
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
Fix indent_continue not indenting nested statements #3816
base: master
Are you sure you want to change the base?
Fix indent_continue not indenting nested statements #3816
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ciao Daniele,
I tested the PR over 3200 files and it does fix a lot of mis-indentation.
On the other hand I also spotted few regressions, with some code being indented too much. The regressions are similar in concept to the modified "expected" cpp files in this PR, where you can see extra indentation added.
If you could find a way to fix this PR so that the extra indentation is not present, it would be a great PR to merge.
Assuming the regressions are similar to the one in The other modified "expected" .cpp files should not contain more indentation than necessary I think, could you confirm that? |
Yes, the regression I observed are similar to the one in Regarding the other modified tests, it could probably be a subjective thing. For example |
It would be helpful, thanks!
It does look awkward indeed, but it is consistent with how lambdas are indented normally. In this case, the
Moreover, if you add extra parameters to B, with this PR you will get something like this, which I think it is correct:
Compare it with the current behavior; doesn't this look even weirder with those parameters squashed to B()'s level?
Like you said, it may be a subjective thing, and another option to adjust for personal preferences would be needed I guess. |
d435b53
to
8d003af
Compare
I have attached an example showing some regressions, including the config used to test it. Note that I use negative values for indent_continue. Re lambda indentation, I see the point in your comment. Also there is an interesting idea proposed in issue #3815, so the solution may be to merge this PR (once the other regressions are fixed) and then add an option as proposed by @PoeticPete. |
8d003af
to
396acc1
Compare
396acc1
to
2adf01c
Compare
6b3e58a
to
2adf01c
Compare
6b3e58a
to
2adf01c
Compare
Allows indent_continue to increment the indentation level in nested statements.
The LANG_OC check is to ensure previous behavior since this could break Objective-C code in strange ways I will not be able to fix properly at the moment.
This fixes all indenting problems in my C++ codebase without introducing regressions, especially in code inside lambdas, but feedback and broader testing is very much appreciated.
Fixes #3752.