-
Notifications
You must be signed in to change notification settings - Fork 297
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 indentation for closing parentheses #444
base: master
Are you sure you want to change the base?
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @chris-morgan (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
@login224444 as you had the same issue, could you give this patch a try to see if it also fixes the indentation for you? Thanks! |
if l:paren_start != 0 && l:paren_start < a:lnum | ||
return indent(l:paren_start) | ||
endif | ||
endif |
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.
Frankly, I'm not sure if this it the best way of going about fixing this, but it seemed to be the least problematic approach. I spent some time trying to figure out if there's another way (e.g. setting some option), but it seems that enabling cindent
results in this behaviour, without there being an obvious way of disabling the indentation of )
.
To help explain this problem, consider this input (where | is the cursor): foo(|) Prior to this commit, pressing Enter would result in the following: foo( |) That is, the closing parenthesis is indented by one level. This is the case regardless of the cindent options/keys chosen. To fix this, we manually indent lines that start with a ")" (ignoring leading whitespace). Such lines are indented according to the indentation of the line that contained the opening parenthesis. Fixes rust-lang#443
Yes, it's pretty good. Thanks! |
@chris-morgan Any thoughts on these changes? 😃 |
@chris-morgan As per #444 (comment), do you have any thoughts on these changes? Or is this plugin no longer actively maintained? |
I am so glad someone else had this issue and made a pull request! |
To help explain this problem, consider this input (where | is the
cursor):
Prior to this commit, pressing Enter would result in the following:
That is, the closing parenthesis is indented by one level. This is the
case regardless of the cindent options/keys chosen.
To fix this, we manually indent lines that start with a ")" (ignoring
leading whitespace). Such lines are indented according to the
indentation of the line that contained the opening parenthesis.
Fixes #443