컴파일 또는 링크가 느린 건 참아도, 편집기가 느린 건 못 참아주겠다!

  • 서비스팩을 설치한다.
  • 인텔리센스를 끈다. (http://serious-code.net/moin.cgi/VisualStudioTips#head-1312c2269e254b39543f98684b00988688008aac)
  • 애니메이션을 비활성화한다. (도구 -> 옵션 -> 환경 -> 환경 도구에 애니메이션 효과 주기 X)
  • 탐색모음을 비활성화한다. (도구 -> 옵션 -> 텍스트 편집기 -> 해당 언어 -> 탐색 모음 X)
  • 변경 내용 추적을 비활성화한다. (도구 -> 옵션 -> 텍스트 편집기 -> 변경 내용 추적 X)
  • 활성화된 항목 추적을 비활성화한다. (도구 -> 옵션 -> 프로젝트 및 솔루션 -> 솔루션 탐색기에서 활성화된 항목 추적 X)
  • %HOMEPATH%\Local Settings\Application Data\Microsoft\WebsiteCache\ 폴더 안에 있는 파일들을 정기적으로 삭제한다. (http://blogs.geocortex.net/blogs/geocortex/archive/2007/12/07/slow-visual-studio-performance-solved.aspx)
  • 다른 형상 관리툴 같은 경우에는 어떤지 모르겠는데, 퍼포스의 P4SCC 인터페이스 같은 경우 주기적으로 서버를 폴링하면서 업데이트를 체크한다. 이걸 비활성화한다. (도구 -> 옵션 -> 소스 제어 -> 플러그인 설정 -> 고급 -> Connection -> Data retrieval)
  • 여건이 된다면 2005보다는 2008을 사용한다. :)

2009/11/12 16:46 2009/11/12 16:46
받은 트랙백이 없고, 댓글 2개가 달렸습니다.

댓글+트랙백 RSS :: http://serious-code.net/tc/rss/response/18

댓글+트랙백 ATOM :: http://serious-code.net/tc/atom/response/18

제목 그대로 선택된 라인들에서 중복된 라인들은 삭제하고 나머지를 정렬하기 위한 매크로입니다.

Visual Assist에 선택된 라인 정렬 기능이 있기는 한데, 중복 라인 삭제는 없어서, 어쩔 수 없이 만들었습니다. 주 목적은 아무래도 C++/include 구문 정리가 되겠습니다.

Collection 객체에 정렬 함수가 따로 없다는 것이 좀 의외군요.

Function Strip(ByVal strLine As String)
    If Len(strLine) > 0 Then       
        nBegin = 1
        nEnd = Len(strLine)
        For i = 1 To Len(strLine)
            c = Mid(strLine, i, 1)
            If c <> " " And c <> Tab And c <> Lf And c <> Cr Then
                nBegin = i
                Exit For
            End If
        Next
        For i = 1 To Len(strLine)
            c = Mid(strLine, Len(strLine) - i + 1, 1)
            If c <> " " And c <> Tab And c <> Lf And c <> Cr Then
                nEnd = Len(strLine) - i + 1
                Exit For
            End If
        Next
        Return Mid(strLine, nBegin, nEnd - nBegin + 1)
    Else
        Return ""
    End If
End Function

Sub SortCollection(ByRef oCollection As Collection, Optional ByVal bSortAscending As Boolean = True)
    Dim lSort1 As Integer
    Dim lSort2 As Integer
    Dim vTempItem1 As Object
    Dim vTempItem2 As Object
    Dim bSwap As Boolean

    For lSort1 = 1 To oCollection.Count - 1
        For lSort2 = lSort1 + 1 To oCollection.Count
            If bSortAscending Then
                If oCollection(lSort1) > oCollection(lSort2) Then
                    bSwap = True
                Else
                    bSwap = False
                End If
            Else
                If oCollection(lSort1) < oCollection(lSort2) Then
                    bSwap = True
                Else
                    bSwap = False
                End If
            End If
            If bSwap Then
                vTempItem1 = oCollection(lSort1)
                vTempItem2 = oCollection(lSort2)
                oCollection.Add(vTempItem1, Nothing, lSort2)
                oCollection.Add(vTempItem2, Nothing, lSort1)
                oCollection.Remove(lSort1 + 1)
                oCollection.Remove(lSort2 + 1)
            End If
        Next
    Next
End Sub

Sub SortAndRemoveDuplicatedLine()
    Dim objLines As New Collection
    Dim objSel As TextSelection = ActiveDocument().Selection
    Dim objRanges As TextRanges = objSel.TextRanges
    Dim objStartPt As EditPoint = objRanges.Item(1).StartPoint.CreateEditPoint()
    Dim objStream As New StringBuilder

    For Each strLine In objSel.Text.Split(Lf)
        strLine = Strip(strLine)
        If objLines.Contains(strLine) = False Then
            objLines.Add(strLine, strLine)
        End If
    Next

    SortCollection(objLines)

    For Each strLine In objLines
        objStream.AppendLine(strLine)
    Next

    objSel.Text = ""
    objStartPt.Insert(objStream.ToString())
End Sub

이 포스트 내용에 대한 이후 업데이트는 http://serious-code.net/moin.cgi/VisualStudioMacro 페이지에서만 이루어질 예정입니다. :)
2009/11/04 16:33 2009/11/04 16:33
받은 트랙백이 없고, 댓글이 없습니다.

댓글+트랙백 RSS :: http://serious-code.net/tc/rss/response/17

댓글+트랙백 ATOM :: http://serious-code.net/tc/atom/response/17