tags:

views:

314

answers:

1

After certain R#-recommended edits R# colors the background of blocks of code in a light royal blue and also places a mark next to the scroll bar with the same color. It is not an error or even a suggestion. It seems to be a temporary flag that clears if you close and reopen a file.

Steps to recreate:

  1. Write a line of code like: string str = string.Format("{0}", 1);
  2. Notice that R# will mark the str var with a light gray because it is never used.
  3. Press Alt+Enter on the variable and select Remove Declaration from the R# context menu
  4. See the line of code turn light royal blue...
  5. Hover your cursor over the scroll bar marker, all you see is the code...

Does anyone know the meaning/usefulness of this "flagging"?

EDIT: My Resharper version is 4.5 running in VS 2005

+3  A: 

I've verified the behavior that you're seeing in R# 4.5 VS 2008 (build 4.5.1274.1). I've gone through the ReSharper specifc colors in Tools->Options->Environment->Fonts and Colors and found this to be "ReSharper Highlight". I searched the ReSharper defect tracking for "remove declaration" and found this report:

RSRP-68435

A "remove declaration" fix appears for the declaration of test. Selecting this removes the declaration, but ends up coloring the then and else clauses of the if statement blue and adds blue bars to the error strip.

The Jetbrain's answer is:

This fix works as designed. Removing declaration can break code, so all broken usages highlighted and you can navigate them and fix or remove code. Only simple expressions are removed automatically (strings, numbers).

James Kolpack
Great sleuthing kolpack, thanks! In addition, the thing that threw me about the blue highlighting is what another issue comment mentioned about the color: Once the code is patched up however, the blue highlighting remains. An undo also does not remove this highlighting. (from the same link you listed above.)
Paul Sasik