mrfangzheng

Hope and fear are useless. Be confident, and always be prepared for the worst.
  首页  :: 新随笔  :: 联系 :: 管理

Visual Studio Marco : CollapseLogRegions

Posted on 2009-10-16 16:11  mrfangzheng  阅读(197)  评论(0编辑  收藏  举报

 

Sub CollapseLogRegions()
        Dim objSelection As TextSelection
        objSelection = DTE.ActiveDocument.Selection
        objSelection.StartOfDocument()
        While (objSelection.FindText( "^.*region.*(DEBUG|ERROR|INFO|WARN).*$" , vsFindOptions.vsFindOptionsRegularExpression))
            objSelection.StartOfLine(vsStartOfLineOptions.vsStartOfLineOptionsFirstColumn)
            DTE.ExecuteCommand("Edit.ToggleOutliningExpansion")
            objSelection.StartOfDocument()
        End While
        DTE.ActiveDocument.Selection.StartOfDocument()
End Sub