Line under local variables in latest Rider EAP
Answered
The latest Rider EAP introduced a line under a bunch of local variables:
Here, "yPos" is underlined. I can't tell why those are there - is it to signify that a variable is changed by the method?
How do I turn that off? Can't find any entries in the setting menu.
Please sign in to leave a comment.
Hello!
Rider emphasize reassigned local variables, but in ReSharper Dark Color scheme, you're most likely using, this should be done by making such variables bold.
Can you please share a copy of your color scheme (`Settings | Editor | Color Schemes | `Gear Icon` | Export | .icls`), this would really help in understanding why this happened.
Also you can always disable that at `Settings | Editor | Color Schemes | Language Defaults | Identifiers | Reassigned local variable` by checking `Inherit values from` box, or changing the colors to something else entirely.
Thanks!
Hi!
I'm using the "Visual Studio Dark" scheme, so it seems to be intended. ReSharper Dark indeed shows it as bold.
Thanks for letting me know how to turn it off!
Reproduced, thanks!
Would it be helpful if Rider started to highlight it as bold by default?
I really don't find the feature helpful at all, so I'm not the correct person to ask. Reassigning local variables is very, very common, so I don't think it's something that should have any kind of highlighting.
What's the intention behind it?
Well, the rationale is the more user sees about the code the better.
Mutability often complicates the code, and make people reason about all possible paths in which the state can be changed, to make sure it's correct. Also as C language heritage C# has ability to have accidental assignments in conditions (e.g. `if (var = smth)`), seeing variable highlighted as mutable, whereas you don't really changed it, can help to spot that.
Some languages control mutability of locals and parameters (e.g. Kotlin's `val` vs `var`), C# currently doesn't, but it still could be helpful to differ them at least visually.
Nevertheless, I think we'd better change coloring to the way it was before is VS-like schemes, since their primary concern is to look familiar to VS uses, and don't overwhelm them with a lot of code highlighting.
Thanks for reporting!
If you introduce something like this, it should be explained in a suitable location. I looked for it in the help and didn't find anything about it. Please add an article in your documentation about all text formattings and their meanings and ensure it is found when searching the help.
I intuitively associated it with code smell warnings but didn't find there anything either. If you find something more subtle, fine, but an underline is something very strong (as it is in any underlined text) and it signals that the underlined words needs more attention than non-underlined words, which often is not the case. Bold would appear nearly equally evil to me. Both text styles are just ugly, please make this configurable at least. One less aggressive possibility to show mutability would be by tooltip information or limit it to the variable declaration.
Hello Eberhard,
Thank you for your feedback.
We have this article in documentation: Colors schemes: fonts and colors of IDE text. It explains how to adjust code highlighting leading to the Settings | Editor | Color Scheme | C# settings page. There is a built-in editor for previewing the colorscheme. Clicking at at the highlighted symbol there focuses the corresponding node in the list:
Also, there is a “Jump to Colors and Fonts” action. There is how it works: put caret at a symbol → press Shift+Shift → type and select “Jump to Colors and Fonts” → if there is a choice, select one of the options → a settings window for color scheme opens and the selected type of symbol is focused in the list:
Hope that helps.
Have a nice day!