是否可以在 Visual Studio 中配置具有特定逻辑的区域快捷方式?

Is that possible to configure Region shortcuts with specific logic in Visual Studio?

好时光,

我和一位在单元测试方法中使用#region 语句的同事一起工作。

[Test]
public void Test()
{
  #region Arrange
  // Code here
  #endregion

  #region Act
  // Code here
  #endregion

  #region
  // Code here
  #endregion
}

如果我想关闭这些方法,标准大纲键可以帮助我,但当我想通过一个组合键展开一个方法内的所有 Arrange\Act\Assert 块时,它没有帮助。我应该去每个区域,然后按 Ctrl + M + M。(我知道 Expand All,但它还有一些其他问题)。

真烦人,我想知道是否可以扩展选定或当前块内的所有区域。如果不可能 - 有没有办法使用 Roslyn 或其他方法对其进行编程?

P.S。我使用 VS 2015.

更新1。我知道讨厌的区域,但它也会屏蔽有用的区域。

CTRL + M + M 将 collapse/expand 当前部分。

#region test1
    void test()
    {

    }
    #endregion

    #region test2
    void test2()
    {

    }
    #endregion

    #region test3
    void test3()
    {

    }
    #endregion

我刚刚选择了 test1 和 test2,按 CTRL + M + M 它只扩展了这两个区域。