2011-09-28 131 views
3

Visual Studio似乎不會限制打開的編輯器選項卡的數量。 我使用ReSharper,並且在一定數量的打開的編輯器選項卡中,事情變得非常緩慢。所以我必須跟蹤打開的標籤並定期關閉舊標籤。 如果我可以設置限制,以便在達到限制時關閉舊選項卡,這將很酷。Visual Studio 2010:限制編輯器選項卡的數量

VS/ReSharper或任何VS插件中的設置可以幫助實現此目的嗎?

+0

也許並不會有太大的幫助,但我覺得ReSharper的難以忍受(即使我與12GB的RAM的Xeon處理器),因爲這樣的事情,所以我刪除,並使用生產力電動工具,而不是:HTTP:// visualstudiogallery。 msdn.microsoft.com/d0d33361-18e2-46c0-8ff2-4adea1e34fef – Deleted

回答

2

我正試圖用一個原始插件來解決此問題。似乎工作正常。仍在測試它。

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

非常有趣。遺憾的是,它並不完整,您如何獲得'documentWindows'?作爲Visual Studio的IntelliJ用戶和新手,我真的很想念這個功能(除其他之外:))...感謝提前。 – Yanflea

+0

documentWindows只是我維護的一個窗口列表,它除了字段定義之外都在上面的代碼中。除了Windows列表定義之外,我所有的添加代碼都在上面。其他一切都是在VS中創建VS添加項目時生成的標準樣板代碼。 – axk

+0

https://marketplace.visualstudio.com/items?itemName=davemckeown.TidyTabs – Jack

相關問題