Visual Studio:有没有办法用一个快捷方式执行"在文件中查找"?

Meh*_*ANI 5 visual-studio

我想在代码中选择一个表达式并输入Ctrl + Whatever,
因此它与[Ctrl + Shift + F和单击"查找全部"]具有相同的结果

编辑:[Ctrl + Shift + F并按下Enter]可能比点击更快但我仍然想要更具体和更快的东西

备注:我对" 查找所有引用"快捷方式不感兴趣 .

Fos*_*sco 8

你可以使用一个宏.我在VS2010中录制并修改了一个:

Sub FindAllFiles()
    DTE.Find.FindWhat = DTE.ActiveDocument.Selection.ToString()
    DTE.Find.Target = vsFindTarget.vsFindTargetFiles
    DTE.Find.MatchCase = False
    DTE.Find.MatchWholeWord = False
    DTE.Find.MatchInHiddenText = True
    DTE.Find.PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxLiteral
    DTE.Find.SearchPath = "Entire Solution"
    DTE.Find.SearchSubfolders = True
    DTE.Find.FilesOfType = ""
    DTE.Find.ResultsLocation = vsFindResultsLocation.vsFindResults1
    DTE.Find.Action = vsFindAction.vsFindActionFindAll
    If (DTE.Find.Execute() = vsFindResult.vsFindResultNotFound) Then
        Throw New System.Exception("vsFindResultNotFound")
    End If
End Sub
Run Code Online (Sandbox Code Playgroud)

宏可以设置为键盘快捷方式.请参阅:http://msdn.microsoft.com/en-us/library/a0003t62(v = vs.80).aspx