简体   繁体   English

使用ReSharper的“删除未访问字段”快速修复后导航

[英]Navigating after using ReSharper's 'Remove Not Accessed Field' quick fix

When using the 'Remove not accessed field' quick fix option from the ReSharper context menu, it highlights the affected line. 使用ReSharper上下文菜单中的“删除未访问字段”快速修复选项时,它会突出显示受影响的行。

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). 使用'unusedField'字段上的'删除未访问字段'quickfix,突出显示构造函数中的行(看到该行已更新)。 The editing caret stays near the line where the field declaration was. 编辑插入符号位于字段声明所在的行附近。

在此输入图像描述

Using the fact that it's highlighted as a search result the former site of usage of a field, you can use ReSharper | 使用ReSharper | 作为搜索结果突出显示字段的旧网站使用的事实 Find | Find | Next Item (which for me using (I think) the default VS keybindings is Ctrl + Alt + PgDn ) to go there. Next Item (我使用(我认为)默认的VS键绑定是Ctrl + Alt + PgDn )去那里。

Once there, you could maybe Ctrl + Shift + L to delete the line (a VS shortcut), or End then Alt + Enter and Introduce variable (R#). 在那里,您可以按Ctrl + Shift + L删除该行(VS快捷方式),或者结束然后按Alt + EnterIntroduce variable (R#)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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