Results 1 to 2 of 2

Thread: IDE Macro to set breakpoints

  1. #1

    Thread Starter
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536

    IDE Macro to set breakpoints

    My .NET solution contains over 150 individual files and I want to write an IDE macro that will set a breakpoint on every line of code that starts with "Debug.Write".

    Anybody got any idea how to do this?
    This world is not my home. I'm just passing through.

  2. #2

    Thread Starter
    Frenzied Member trisuglow's Avatar
    Join Date
    Jan 2002
    Location
    Horsham, Sussex, UK
    Posts
    1,536
    Nobody got any ideas? This is what I've got so far, but the condition on the While loop always returns True - I can't find a way of stopping searching when I've reached the end of the file.



    VB Code:
    1. Public Sub macBREAKPOINT()
    2.  
    3.  
    4.         Dim proj As Project = DTE.Solution.Projects.Item(1)
    5.  
    6.         Dim projitem As ProjectItem
    7.  
    8.         Dim blnOK As Boolean = False
    9.  
    10.         Dim i As Integer
    11.  
    12.         Dim objFind As Find
    13.  
    14.         For Each projitem In proj.ProjectItems
    15.                 If Right(projitem.Name, 3) = ".vb" Then
    16.                     Debug.Write(projitem.Name & vbCrLf)
    17.  
    18.                     DTE.ItemOperations.OpenFile(projitem.Name)
    19.  
    20.                     objFind.FindWhat = "Debug.Write"
    21.                     objFind.Target = vsFindTarget.vsFindTargetCurrentDocument
    22.                     objFind.MatchCase = False
    23.                     objFind.MatchWholeWord = False
    24.                     objFind.Backwards = False
    25.                     objFind.MatchInHiddenText = True
    26.                     objFind.PatternSyntax = vsFindPatternSyntax.vsFindPatternSyntaxLiteral
    27.                     objFind.Action = vsFindAction.vsFindActionFindAll
    28.  
    29.                     DTE.ActiveDocument.Selection.StartOfDocument()
    30.  
    31.                     While objFind.Execute() = vsFindResult.vsFindResultFound
    32.  
    33.                         DTE.ExecuteCommand("Debug.ToggleBreakpoint")
    34.                         DTE.ActiveDocument.Selection.EndOfLine()
    35.  
    36.                     End While
    37.  
    38.                     DTE.ActiveWindow.Close(vsSaveChanges.vsSaveChangesNo)
    39.                 End If
    40.         Next
    41.  
    42.     End Sub
    This world is not my home. I'm just passing through.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width