本文翻译自:VS 2012: Scroll Solution Explorer to current file
VS2010 had the feature that viewing a file would automatically cause Solution Explorer to scroll to that file. VS2010具有查看文件会自动导致解决方案资源管理器滚动到该文件的功能。
With VS2012, viewing different files from within the IDE no longer scrolls and select the file in Solution Explorer automatically. 使用VS2012,从IDE中查看不同的文件不再滚动并自动在解决方案资源管理器中选择该文件。
Is it possible to get this feature back? 有可能恢复此功能吗? Is there a setting somewhere? 某处有设置吗? If so, how/where? 如果是这样,怎么/在哪里?
#1楼
参考:https://stackoom.com/question/rDKy/VS-将解决方案资源管理器滚动到当前文件
#2楼
Yes, you can find that under 是的,你可以找到它
Tools - > Options - > Projects and Solutions - > Track Active Item in Solution Explorer 工具 - >选项 - >项目和解决方案 - >在解决方案资源管理器中跟踪活动项
It's off by default (as you've noticed), but once it's on, Solution Explorer will expand folders and highlight the current document as you switch between files. 它默认是关闭的(正如您所注意到的),但一旦打开,解决方案资源管理器将展开文件夹并在文件之间切换时突出显示当前文档。
#3楼
If you need one-off sync with the solution pane, then there is new command "Sync with Active Document" (default shortcut: Ctrl + [ , S ). 如果您需要与解决方案窗格进行一次性同步,则会出现新命令“与Active Document同步”(默认快捷键: Ctrl + [ , S )。 Explained here: Visual Studio 2012 New Features: Solution Explorer 这里解释: Visual Studio 2012新功能:解决方案资源管理器
#4楼
If you have ReSharper installed clicking Shift + Alt + L will move focus to the current file in Solution Explorer. 如果安装了ReSharper,请单击Shift + Alt + L将焦点移至解决方案资源管理器中的当前文件。
Active Item Tracking will also need to be enabled as described in the accepted answer 还需要启用活动项跟踪,如接受的答案中所述
Tools->Options->Projects and Solutions->Track Active Item in Solution Explorer 工具 - >选项 - >项目和解决方案 - >在解决方案资源管理器中跟踪活动项
#5楼
There are many ways to do this: 有很多方法可以做到这一点:
Go to current File once: 转到当前文件一次:
Visual Studio 2013 Visual Studio 2013
VS 13 has it's own shortcut to do this: Ctrl + \\ , S (Press Ctrl + \\ , Release both keys, Press the S key) VS 13有自己的快捷方式: Ctrl + \\ , S (按Ctrl + \\ ,释放两个键,按S键)
You can edit this default shortcut, if you are searching for
SolutionExplorer.SyncWithActiveDocument
in yourKeyboard Settings
(Tools->Options->Enviornment->Keyboard) 如果要在Keyboard Settings
中搜索SolutionExplorer.SyncWithActiveDocument
(工具 - >选项 - >环境 - >键盘),则可以编辑此默认快捷方式In addition there is also a new icon in the Solution Explorer, more about this here . 此外,解决方案资源管理器中还有一个新图标, 此处有更多相关信息。
Visual Studio 2012 Visual Studio 2012
If you use VS 2012, there is a great plugin to add this new functionality from VS2013 to VS2012: . 如果你使用VS 2012,有一个很棒的插件可以将这个新功能从VS2013添加到VS2012 :. The default shortcut is strg + alt + ü . 默认快捷方式是strg + alt + ü 。 I think this one is the best, as navigating to the solution explorer is mapped to strg + ü . 我认为这是最好的,因为导航到解决方案资源管理器映射到strg + ü 。
Resharper ReSharper的
If you use Resharper try Shift + Alt + L 如果您使用Resharper,请尝试Shift + Alt + L.
This is a nice mapping as you can use Strg + Alt + L for navigating to the solution explorer 这是一个很好的映射,因为您可以使用Strg + Alt + L导航到解决方案资源管理器
Track current file all the time: 始终跟踪当前文件:
Visual Studio >= 2012 : Visual Studio> = 2012 :
If you like to track your current file in the solution explorer all the time, you can use the solution from the accepted answer (Tools->Options->Projects and Solutions->Track Active Item in Solution Explorer), but I think this can get very annoying in large projects. 如果您希望始终在解决方案资源管理器中跟踪当前文件,可以使用已接受答案中的解决方案(工具 - >选项 - >项目和解决方案 - >在解决方案资源管理器中跟踪活动项目),但我认为这可以在大型项目中变得非常讨厌。
#6楼
I've found the Sync with Active Document
button in the solution explorer to be the the most effective (this may be a vs2013 feature!) 我发现解决方案资源管理器中的“ Sync with Active Document
按钮是最有效的(这可能是vs2013功能!)