问题描述
Visual Studio 似乎没有限制打开的编辑器选项卡的数量.我正在使用 ReSharper,并且在打开一定数量的编辑器选项卡时,事情变得非常缓慢.所以我必须跟踪打开的标签并定期关闭旧标签.如果我可以设置一个限制以便在达到限制时关闭旧标签会很酷.
Visual studio doesn't appear to limit the number of opened editor tabs.I'm using ReSharper and at a certain number of opened editor tabs things get really slow. So I have to keep track of opened tabs and periodically close old ones.It would be cool if I could set a limit so that it would close old tabs when the limit is reached.
VS/ReSharper 或任何 VS 插件中是否有可以帮助实现这一目标的设置?
Is there a setting in VS / ReSharper or any VS addons that can help to achieve this?
推荐答案
我目前正在尝试使用原始插件解决此问题.似乎工作正常.还在测试中.
I'm trying to solve this with a primitive addin at the moment. Seems to be working fine. Still testing it.
public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
_applicationObject = (DTE2)application;
_applicationObject.Events.WindowEvents.WindowCreated +=
window =>
{
if (window.Document != null)
{
documentWindows.AddFirst(window);
if(documentWindows.Count > 7)
{
Window lastWindow = documentWindows.Last.Value;
documentWindows.Remove(lastWindow);
lastWindow.Close(vsSaveChanges.vsSaveChangesYes);
}
}
};
_applicationObject.Events.WindowEvents.WindowClosing +=
window =>
{
if(window.Document != null)
{
documentWindows.Remove(window);
}
};
}
这篇关于Visual Studio 2010:限制编辑器选项卡的数量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!