Visual Studio中上一个和下一个调用堆栈框架的热键 [英] Hotkeys for Previous and Next call stack frames in Visual Studio
问题描述
Visual Studio提供了许多导航热键: 当前面板中下一项的 F8 (搜索结果,错误...), Control + K , N 用于书签, Alt + -可以返回更多内容.
Visual Studio gives many navigation hotkeys: F8 for next item in current panel (search results, errors ...), Control+K, N for bookmarks, Alt+- for going back and more.
我找不到一个热键,甚至找不到它的菜单命令,所以我自己也无法创建该热键.
There is one hotkey that I can't find, and I can't even find the menu-command for it, so I can't create the hotkey myself.
我不知道是否存在:上一个和下一个调用堆栈帧.
I don't know if such exist: Previous and Next call-stack frame.
我尝试在编程时不使用鼠标,但是当我需要返回堆栈时,必须使用它来双击上一帧.
I try not using the mouse when programming, but when I need to go back the stack, I must use it to double click the previous frame.
有人吗?这样做的宏怎么样?
Anyone? How about a macro that does it?
推荐答案
我编写了2个宏来获取它:PreviousStackFrame
和NextStackFrame
,并为它们分配了快捷方式
I wrote 2 macros to gain it: PreviousStackFrame
and NextStackFrame
and assigned shortcuts to
Function StackFrameIndex(ByRef aFrames As EnvDTE.StackFrames, ByRef aFrame As EnvDTE.StackFrame) As Long
For StackFrameIndex = 1 To aFrames.Count
If aFrames.Item(StackFrameIndex) Is aFrame Then Exit Function
Next
StackFrameIndex = -1
End Function
Sub NavigateStack(ByVal aShift As Long)
If DTE.Debugger.CurrentProgram Is Nothing Then
DTE.StatusBar.Text = "No program is currently being debugged."
Exit Sub
End If
Dim ind As Long = StackFrameIndex(DTE.Debugger.CurrentThread.StackFrames, DTE.Debugger.CurrentStackFrame)
If ind = -1 Then
DTE.StatusBar.Text = "Stack navigation failed"
Exit Sub
End If
ind = ind + aShift
If ind <= 0 Or ind > DTE.Debugger.CurrentThread.StackFrames.Count Then
DTE.StatusBar.Text = "Stack frame index is out of range"
Exit Sub
End If
DTE.Debugger.CurrentStackFrame = DTE.Debugger.CurrentThread.StackFrames.Item(ind)
DTE.StatusBar.Text = "Stack frame index: " & ind & " of " & DTE.Debugger.CurrentThread.StackFrames.Count
End Sub
Sub PreviousStackFrame()
NavigateStack(1)
End Sub
Sub NextStackFrame()
NavigateStack(-1)
End Sub
这篇关于Visual Studio中上一个和下一个调用堆栈框架的热键的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!