Gray names for unused functions (using solution-wide-analysis)

In the 4.5 beta, using solution-wide analysis, public methods that were unused in the solution showed up with grayed out names (the same as private methods that were unused). This was super-usefull for me. In the final 4.5 release however, unused public methods show up as a suggestions (with the little squiggly underline). I understand that this allows me to set the severity of the unused method, but having it be visually distinct from other suggestions was extremely helpful to me, not to mention it was consistent with the meaning of the grayed-out-name for private methods. It tends to blend in with other suggestions/warnings in my file, where I want it to stand out the same as an unused private method.

I was wondering, is there some way I can re-enable the graying-out of unused public method names so they look the same as the unused private method names? I looked for an option, but was unable to find one.

For example:

private void DoSomething() {...}

will show up gray if I don't call it anywhere in my class

public void DoSomethingElse() { ... }

will show up normally, but with a squiggly suggestion underline.

0
9 comments

Hi.

You may change severity of “Unused declaration (non-private accessibility) “.

This setting may either be changed via “Options/Code Inspection/Inspection severity” or via the special QuickFix “Inspection options for…” on the “squiggly underlined code”.

Change severity from ‘suggestion’ to ‘warning’.



0
Avatar
Permanently deleted user

Thanks. I didn't realize that this would cause the text to be grayed. It works now. Appreciate it!

0
Avatar
Permanently deleted user

In fact, we decided that the current behaviour is not convenient and changed
it for 4.5.1 bug-fix release. In ReSharper 4.5.1 unused methods are grayed
unless severity of this highlighting is set to error (that is unlikely).

Valentin Kipiatkov
CTO and Chief Scientist
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

In the 4.5 beta, using solution-wide analysis, public methods that
were unused in the solution showed up with grayed out names (the same
as private methods that were unused). This was super-usefull for me.
In the final 4.5 release however, unused public methods show up as a
suggestions (with the lit

tle squiggly underline). I understand that this allows me to set the
severity of the unused method, but having it be visually distinct from
other suggestions was extremely helpful to me, not to mention it was
consistent with the meaning of the grayed-out-name for private
methods. It tends to blend i

n with other suggestions/warnings in my file, where I want it to stand
out the same as an unused private method.

I was wondering, is there some way I can re-enable the graying-out of
unused public method names so they look the same as the unused private
method names? I looked for an option, but was unable to find one.

For example:

private void DoSomething() {...}

will show up gray if I don't call it anywhere in my class

public void DoSomethingElse() { ... }

will show up normally, but with a squiggly suggestion underline.

---
Original message URL:
http://www.jetbrains.net/devnet/message/5235874#5235874



0

This seem to not work anymore. I am using Visual Studio community editor with the latest version of Resharper as of date.

Any inputs as to why this is not working anymore? I changed it to warning and error yet it does not grey out.

0

Hello Amit Suri

 

Could you please specify if the problem reproduced in some specific solution or in a newly created also?

If it's some specific solution please try clearing caches via ReSharper | Options | Environment | General | Clear caches and let me know if the helps.

Thank you.

0

I found the solution to the problem from this answer 

https://stackoverflow.com/questions/38443275/why-does-visual-studio-gray-out-parameter-names

Re-Quote:

"It is just a theme selection, the default theme doesn't pick anything garish and gray here doesn't mean "disabled". Just "different". You can make it anything you want with Tools > Options > Environment > Fonts and Colors > Display Items = "C++ Parameters". – Hans Passant Jul 18 '16 at 19:43"

I fixed it by changing the Color of the "Resharper Analysis Dead Code" Display Item in that list to Grey color manually. For whatever reason it was set to "Black" which wasted the analysis capability just because of a wrong color being set. This capability is very useful while refactoring code but having it not show up is just wasteful when the Resharper tool already does the hard work!

Anyways, hope you can fix this. I shouldn't need to manually change colors for each of these display items. They should be governed by some theme /profile  for example.

Btw, in the pro version of Visual Studio I've never had this problem.

0

Hello Amir,

 

Could you please specify what VS theme do you use?

Do I understand correctly that you've experienced problem in C++ project?

Thank you.

0

No. The problem was with C#.

I found the solution earlier from that link above.

If you search for the keyword that I have mentioned in my comment above it should be easy to see the problem and solution.

 

0

Hello Amit,

 

"ReSharper Analysis Dead Code" provides some default color for highlighting still ReSharper inspections (like "Type member is never used") highlight unused code in color a little bit lighter then the default one.

So it's ok for light themes to use black color as a default one for "Resharper Analysis Dead Code" as it will be highlighted as grey for unused code anyway.

Thank you.

 

 

0

Please sign in to leave a comment.