Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resharper function to fix naming convention issues

Tags:

resharper

A bunch of classes doesn't comply to our naming conventions for private variables. Resharper shows this as a warning, but wants me to fix all of them by hand. Is there some magic option to auto-fix these issues?

'Clean-up code' won't do anything with this. Same goes for converting properties with backing fields to automatic properties when possible: the hint is shown, but Resharper won't fix it automatically.

like image 548
Jan Jongboom Avatar asked May 19 '10 10:05

Jan Jongboom


2 Answers

In more recent versions of ReSharper, this is much easier, but the solution might not be obvious. It wasn't for me!

Here are the steps:

  • When an inconsistent naming is detected, ReSharper underlines the symbol in question. Click on it. This will cause a light bulb to appear in the margin.
  • Click on the light bulb. The first option should be 'rename to [corrected name]'. To the right, there's an arrow.
  • Click the arrow to drill down. From there, you can choose Fix in File, Fix in Project, and so on.
like image 148
Brian MacKay Avatar answered Oct 26 '22 08:10

Brian MacKay


No, resharper will not silently perform an action that alters the behavior of code, only style/aesthetics.

You must actively make functional changes to code.

put your cursor at the top of the file, hold down ALT and alternate between PAGE DOWN to get to the next style issue and ENTER to bring up the smart tag to make the change.

use SHFT-ALT PAGE DOWN to cycle through errors.

like image 25
Sky Sanders Avatar answered Oct 26 '22 10:10

Sky Sanders