4

When using the 'Remove not accessed field' quick fix option from the ReSharper context menu, it highlights the affected line.

Is there a keyboard shortcut that will take me to that highlighted line? (As often that line is also redundant and can be removed too)

eg. Given this code:

public class Sample
{
    private string unusedField;

    public Sample()
    {
        unusedField = new string('a', 4);

    }
}

Using the 'Remove not accessed field' quickfix on the 'unusedField' field, highlights the line in the constructor (seeing as that line is updated). The editing caret stays near the line where the field declaration was.

enter image description here

David Gardiner
  • 16,892
  • 20
  • 80
  • 117
  • What version of ReSharper are you using? When I use v6.1 and remove the unused field, it also removes the line with the assignment. – Jay Feb 23 '12 at 03:14
  • I'm using 6.1 too, but it leaves the RHS there (seems reasonable as it could be doing something else useful) – David Gardiner Feb 23 '12 at 05:48

1 Answers1

1

Using the fact that it's highlighted as a search result the former site of usage of a field, you can use ReSharper | Find | Next Item (which for me using (I think) the default VS keybindings is Ctrl+Alt+PgDn) to go there.

Once there, you could maybe Ctrl+Shift+L to delete the line (a VS shortcut), or End then Alt+Enter and Introduce variable (R#).

AakashM
  • 62,551
  • 17
  • 151
  • 186