Visual Studio:将解决scheme资源pipe理器滚动到当前文件的快捷方式

不要求在解决scheme资源pipe理器中自动跟随当前文件的选项。 这个问题已经得到了回答,我有这个选项closures,因为我讨厌的行为。

我想有一个快捷方式(或macros,或….)跳转到我正在编辑解决scheme资源pipe理器中的文件。

据我所知在VS 2012之前没有这样的select。

在VS 2012中,引入了“与活动文档同步”选项。 您可以在此博客上find说明和屏幕(滚动到页面中间的“与活动文档同步”)。

在VS 2013中有一个内置的键盘快捷键 (CTRL + \,S)

  1. 按下CTRL +反斜杠
  2. 释放这两个键
  3. 按下S键

或者单击下图中突出显示的button。

与活动文档同步

其中一个也可以select自定义键盘快捷方式,如果你不喜欢默认的组合:)

在Visual Studio 2015和2017中,您可以按Ctrl + [然后按s

这将突出显示解决scheme资源pipe理器中当前正在编辑的文件

对于VS2010,我发现这个macros,为我工作:

 Imports System Imports EnvDTE Imports EnvDTE80 Imports EnvDTE90 Public Module Utilities Public Sub TrackProjectItem() Dim solution As Solution2 = DTE.Solution If Not solution.IsOpen OrElse DTE.ActiveDocument Is Nothing Then Return solution.FindProjectItem(DTE.ActiveDocument.FullName).ExpandView() Dim FileName As String = DTE.ActiveDocument.FullName Dim SolutionExplorerPath As String Dim items As EnvDTE.UIHierarchyItems = DTE.ToolWindows.SolutionExplorer.UIHierarchyItems Dim item As Object = FindItem(items, FileName, SolutionExplorerPath) If item Is Nothing Then MsgBox("Couldn't find the item in Solution Explorer.") Return End If DTE.Windows.Item(Constants.vsWindowKindSolutionExplorer).Activate() DTE.ActiveWindow.Object.GetItem(SolutionExplorerPath).Select(vsUISelectionType.vsUISelectionTypeSelect) End Sub Public Function FindItem(ByVal Children As UIHierarchyItems, ByVal FileName As String, ByRef SolutionExplorerPath As String) As Object For Each CurrentItem As UIHierarchyItem In Children Dim TypeName As String = Microsoft.VisualBasic.Information.TypeName(CurrentItem.Object) If TypeName = "ProjectItem" Then Dim projectitem As EnvDTE.ProjectItem = CType(CurrentItem.Object, EnvDTE.ProjectItem) Dim i As Integer = 1 While i <= projectitem.FileCount If projectitem.FileNames(i) = FileName Then SolutionExplorerPath = CurrentItem.Name Return CurrentItem End If i = i + 1 End While End If Dim ChildItem As UIHierarchyItem = FindItem(CurrentItem.UIHierarchyItems, FileName, SolutionExplorerPath) If Not ChildItem Is Nothing Then SolutionExplorerPath = CurrentItem.Name + "\" + SolutionExplorerPath Return ChildItem End If Next End Function End Module 

原始来源在这里

在Visual Studio 2010/2012中,您可以使用此扩展( 链接 )。 它增加了在解决scheme资源pipe理器工具栏和代码上下文菜单中同步的选

要在“解决scheme资源pipe理器”中find您正在编辑的文件

Ctrl + W + S

我以前使用Shift + Alt + L ,但由于某种原因,这不再工作。

其他build议( Ctrl+\,SCtrl+[,S和Ctrl +`+ S)在VS2015中不适用于我。 我不使用resharper,而不喜欢简单的快捷键可用时使用macros。

在Visual Studio 2015中,通过使用ReSharper,我可以按Shift + Alt + L突出显示解决scheme资源pipe理器中正在编辑的当前文件。

在我的键盘上,我不得不按下:

Ctrl + ` + S

请注意,中间的标志是退格键左侧的键。

使用Visual Studio 2015。