I often open a file and go to location from a stack trace. It gives information in the following format:
filename:line 999
Here's the macro that I'm bound to Ctrl-Shift-O (because I don't open projects from shortcuts and it is close to Ctrl-O for opening a file).
======
Sub OpenFileFromStackTrace()
Dim ret As String = InputBox("Input filename and line number (example=> c:\myfile.cs:line 321):", "Open File From Stack Trace")
If (ret = String.Empty) Then
Return
End If
Dim spl3 As String() = ret.Split(New [String]() {":line "}, StringSplitOptions.None)
DTE.ItemOperations.OpenFile(spl3(0))
Dim line As Integer = Integer.Parse(spl3(1))
DTE.ActiveDocument.Selection.GotoLine(line, False)
End Sub
================
Monday, December 21, 2009
Visual Studio Macro for Opening a stack trace file
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment