开发者

Visual studio 2010: limiting the number of editor tabs

Visual studio doesn't appear to limit the number of opened editor tabs. I'm using ReSharper and at a certain number of opened edi开发者_如何学JAVAtor 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.

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);
                }
                };
    }
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜