visual-studio 在解决方案资源管理器中从打开的选项卡中自动选择文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/3531867/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-22 12:21:44  来源:igfitidea点击:

Auto select file in Solution Explorer from its open tab

visual-studiovisual-studio-2010

提问by Y. Shoham

Normally, many files in Visual Studio 2010are opened in many tabs, while massively working on a project. Many times, I find myself right-clicking on a tab title and searching for Show/Select/Scroll-to this file in Solution Explorer, and I can't find it.

通常,在大量处理项目时,Visual Studio 2010中的许多文件在许多选项卡中打开。很多时候,我发现自己右键单击选项卡标题并搜索Show/Select/Scroll-to this file in Solution Explorer,却找不到。

Is there a way to automatically select an opened file in Solution Explorer?

有没有办法在解决方案资源管理器中自动选择打开的文件?

回答by Fedearne

Another option is to bind 'View.TrackActivityInSolutionExplorer' to a keyboard short-cut, which is the same as 'Tools-->Options-->Projects and Solutions-->Track Active Item in Solution Explorer'

另一种选择是将“View.TrackActivityInSolutionExplorer”绑定到键盘快捷键,这与“工具-->选项-->项目和解决方案-->在解决方案资源管理器中跟踪活动项”相同

If you activate the short-cut twice the file is selected in the solution explorer, and the tracking is disabled again.

如果您两次激活快捷方式,则会在解决方案资源管理器中选择文件,并再次禁用跟踪。

Visual Studio 2013+

Visual Studio 2013+

There is now a feature built in to the VS2013 solution explorer called Sync with Active Document. The icon is two arrows in the solution explorer, and has the hotkey Ctrl+ [, Sto show the current document in the solution explorer. Does not enable the automatic setting mentioned above, and only happens once.

现在,VS2013 解决方案资源管理器中内置了一项功能,称为与活动文档同步。该图标是解决方案资源管理器中的两个箭头,并且具有热键Ctrl+ [S用于显示解决方案资源管理器中的当前文档。不启用上面提到的自动设置,并且只发生一次。

回答by Francesco De Vittori

I don't know if you can do it on-demand, but you can enable the option "Track Active Item in Solution Explorer" (Tools->Options->Projects and Solutions->General) which will always select the active tab item in the solution explorer.

我不知道您是否可以按需执行此操作,但是您可以启用选项“在解决方案资源管理器中跟踪活动项”(工具->选项->项目和解决方案->常规),它将始终选择活动选项卡项在解决方案资源管理器中。

回答by Maksym Kozlenko

If you're using the ReSharperplugin, you can do that using the Shift+ Alt+ Lshortcut or navigate via menu as shown.

如果您使用的是ReSharper插件,则可以使用Shift+ Alt+L快捷方式或通过菜单导航,如图所示。

Enter image description here

在此处输入图片说明

回答by AJ.

This isn't exactly what you're looking for, but it would automatically select the "active" file in the Solution Explorer:

这并不完全是您要查找的内容,但它会自动在解决方案资源管理器中选择“活动”文件:

Tools-->Options-->Projects and Solutions-->Track Active Item in Solution Explorer.

工具--> 选项--> 项目和解决方案--> 在解决方案资源管理器中跟踪活动项。

回答by friend

The best option now is to install the Microsoft Visual Studio add on called Productivity Power Tools.

现在最好的选择是安装名为Productivity Power Tools的 Microsoft Visual Studio 插件。

With this comes "Solution Navigator" (alternative to Solution Explorer, with a lot of benefits) - which then you can use to filter the files to only show "Open". You can even filter files to show "Edited" and "Unsaved".

随之而来的是“解决方案导航器”(替代解决方案资源管理器,具有很多好处) - 然后您可以使用它来过滤文件以仅显示“打开”。您甚至可以过滤文件以显示“已编辑”和“未保存”。

回答by Basic

It's in VS2012 - Specifically the 2-Arrow icon at the top of the solution explorer (Left/Right arrows, one above the other). This automatically jumps to the current file.

它在 VS2012 中 - 特别是解决方案资源管理器顶部的 2 箭头图标(左/右箭头,一个在另一个上方)。这会自动跳转到当前文件。

This icon is only visible if you've got Track Active Item in Solution Explorerdisabled.

此图标仅在您被Track Active Item in Solution Explorer禁用后才可见。

回答by Tarun

In Visual Studio 2012, the same can be done using the "Sync With Active Document" option in Solution Explorer

在 Visual Studio 2012 中,可以使用解决方案资源管理器中的“与活动文档同步”选项完成相同的操作

回答by themissinglint

The Tab Studio plugin adds "select in solution explorer" to the right click menu on tabs.

Tab Studio 插件将“在解决方案资源管理器中选择”添加到选项卡的右键菜单中。

回答by jpierson

I've put in a feature requestfor this very feature. Although I know this isn't an answer in itself it is a step in the direction of being able to get this feature implemented. Any votes it it may help to get Microsoft's attention.

我已经为这个功能提出了一个功能请求。虽然我知道这本身并不是一个答案,但它是朝着能够实现此功能的方向迈出的一步。任何投票都可能有助于引起微软的注意。

As far as I'm aware of though there is no way to do this other than possibly writing a macro or creating your own add-in/extension to Visual Studio.

据我所知,除了可能编写宏或创建自己的 Visual Studio 加载项/扩展之外,别无他法。

回答by Sergey Pashkevich

There's a very nice extension to VS2010, which does exactly this: Solution Explorer Tools.

VS2010 有一个非常好的扩展,它就是这样做的:解决方案资源管理器工具

This extension adds a button which selects the current file in the solution explorer, as well as convenient buttons for collapsing and expanding projects.

此扩展程序添加了一个按钮,用于在解决方案资源管理器中选择当前文件,以及用于折叠和展开项目的便捷按钮。