-
-
Notifications
You must be signed in to change notification settings - Fork 91
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
Reduce indentations for nested loops #920
Reduce indentations for nested loops #920
Conversation
A couple thoughts I had after looking at this change. If the first Are we sure mixing while/for/foreach should not keep the indentation? When I see two I do like what it does to code like this. I've traditionally been "always braces" but with an auto formatter you don't have the problem of indentation being incorrect. And nested foreachs without the extra indentation is a lot cleaner. |
I definitely think this should only apply to nested loops of the same type. If that makes things more complicated to implement (since we have to keep track of what the previous node was), I think we should apply this behavior to |
I think, it will be better to keep more simple behavior and don't indent even if
If we will keep the indentation for the case of the mixing loop types then we will force a developer to convert loops to one type.
It will better to allow the developer to mix loop types in a way that is bast for his case and still has no unnecessary indentations. But unfortunately, Rider keeps the indentation in this case and I didn't find out a option to change it. Also, Rider show a warning if there is no the indentation. I think, we have to don't conflict with Rider behavior and keep the indentation in this case for now, but try to remove it in the future. |
First of all, thank you very much for the detailed write-up - it's awesome when people are passionate about open source projects 👍 After taking your detailed points into consideration (making developers convert loop types, Rider rules, etc.), I think the best way forward for now is this:
We'll see how that performs in the wild, what people's feedback is, etc. That way,
I think it makes the most sense (even long term) because it covers the most common pattern: (iterating over nested iterators/collections). When someone sees a set of |
I adjusted the code to reduce indentions only for the same loop type and did it for |
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.
Thanks for your contribution!
closes #867