using VS2010
ANSWER thanks to Hans (since I'm to lowly to answer my own question for 8 hrs)
Sub CreateBreakPoint()
Dim doc As TextDocument = _
CType(DTE.ActiveDocument.Object("TextDocument"), TextDocument)
Dim point As EditPoint = doc.StartPoint.CreateEditPoint
While point.NextBookmark()
Try
point.ClearBookmark()
DTE.Debugger.Breakpoints.Add("", DTE.ActiveDocument.FullName, point.Line(), 1, "", dbgBreakpointConditionType.dbgBreakpointConditionTypeWhenTrue, "c#", "", 0, "", 0, dbgHitCountType.dbgHitCountTypeNone)
Catch ex As Exception
MsgBox("error: " + ex.Message)
End Try
End While
MsgBox("Done")
End Sub
I have a macro that will set breakpoints at every bookmark. It works (like a sledgehammer)... but out of curiosity how do I do one of the following so that I can use a "proper" For Loop
- retrieve a list of Bookmark objects (ostensibly with a line number property)
- check for DTE.ExecuteCommand("Edit.NextBookmark") to return false or some indication that I've reached the last bookmark
- retrieve a list of Bookmark objects with a specific "query" so i don't have to first delete all current bookmarks
the current code
Public Module BookMarksToBreakPoints
Sub TemporaryMacro()
Dim bookmarkWin As Window = DTE.Windows.Item(WindowKinds.vsWindowKindBookmarks)
While True
Try
DTE.ExecuteCommand("Edit.NextBookmark")
DTE.ExecuteCommand("Edit.ToggleBookmark")
DTE.ExecuteCommand("Debug.ToggleBreakpoint")
Catch e As Exception
MsgBox("Done")
Exit While
End Try
End While
End Sub
End Module