-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
Bad indentation of scope for multi-line function definition #752
Comments
If you want to keep the meaning of scope, I don't think it should just highlight the first line in the first picture or the second line in the second picture (assuming the scope is within the curly braces?). I guess you would want it to highlight lines 216-219 in the first picture and all but the top row of the second line in the second picture. I don't think this would look very good though. I think your formatting style just doesn't really work well together with scope, and it might be better to just use current indent for those files when it is ready. |
Yeah, your formatting is just very weird. The scope is correct, it starts with the curly braces. It just doesn't look correct because of your formatting. There isn't really anything I can do. |
Fair, basing the scope indent on the end of the scope would make this look better. But the way the scope is currently implemented, this is not possible. It would require a lot of refactoring. |
I have run into what seems to be the same problem. It seems that the problem is caused by the newline in the function or if statement (+ the way the C language tree works). Here are some pictures showing how different formatting doesn't give the problem, but a newline in the if statement and I think I have an idea for how to solve this after #743 is committed, so I can look at it at that time. |
@sfc-gh-mjendruk #795 fixes this for my test cases (above pictures). Could you check if it highlights as you wanted too? (I think the red line goes up one more line than your pictures, because it starts highlighting on the line with |
Hi, I tried out v3.5.1 again, and now it looks like in your screenshot. Not sure what was wrong before, thank you! |
Problem
I noticed an indentation issue of the scope highlighting when viewing C++ files. However I saw the same issue also in Java files so I assume it's a general issue.
My project puts the opening brace
{
in the same line as the if-clause, function parameters, etc. If the parameter list spans multiple lines then it uses the wrong indentation to display the scope (see images).Steps to reproduce
Expected behavior
It should instead highlight the leftmost line in case of the function scope and in case of the if-clause, it should highlight the 2nd line, aligning with the indentation of the
if
.Neovim version (nvim -v)
0.9.1
The text was updated successfully, but these errors were encountered: