简体   繁体   中英

How to turn off “Qualifier 'this.' is redundant” warnings in Resharper?

In my code I have a lot of this. qualifiers (a habit from writing Python code), so I have a lot little orange warning markers in the right hand gutter saying "Qualifier 'this.' is redundant". I don't want to remove the this. qualifiers. How can I turn off the orange warning markers?

For Resharper 9 it's been moved. Actually I never noticed in Resharper 8, because I use " this " for clarity. My problem is that now it's all over the place and it drives me insane. I hope this helps someone, because it took me some time to find this.

Resharper 9位置

Change your settings in the Inspection Severity section. In the C# tab, there is a section called Redundancies in Code . In there is a Redundant this.' qualifier Redundant this.' qualifier setting. I put mine on "Do not show" (gray-colored).

在此输入图像描述

在此输入图像描述

The following is taken from the comment by @user2864740, which the OP found to solve the problem:

It should be possible to open up the ReSharper context menu - click on the pencil thing to the left when the warning is "in focus", or perhaps hit Alt+Enter (?) - and select "Change Inspection Severity..". It should provide several options from Ignore to Error. I believe there is also an inspection option to Require the this. explicitly, but I've never felt inclined to look for or enable it. (Such an option would likely be within the main Code Inspection R# options.)

If you don't have the ($$$) Resharper, you don't need it to remove the orange warning markers or the lightbulb suggestions. You can do this within VS 2015: Follow exactly this set of instructions in the green-checked answer, but tick the "Qualify member access with 'this' " instead. Click OK, and you'll never see another this lightbulb again.

I don't know if this particular configuration is available in other VS versions, but at least you can check your version.

OR, apply the change globally (project-wide or solution-wide) with one click as demonstrated here:

项目范围内删除<code>此</ code>限定符

And you'll never see it again in your project.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM