Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/google-maps/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio Visual Studio中上一个和下一个调用堆栈帧的热键_Visual Studio_Keyboard Shortcuts - Fatal编程技术网

Visual studio Visual Studio中上一个和下一个调用堆栈帧的热键

Visual studio Visual Studio中上一个和下一个调用堆栈帧的热键,visual-studio,keyboard-shortcuts,Visual Studio,Keyboard Shortcuts,Visual Studio提供了许多导航热键: F8用于当前面板中的下一项(搜索结果、错误…), 控件+K,N表示书签, Alt+-用于返回和更多 有一个热键我找不到,我甚至找不到它的菜单命令,所以我不能自己创建热键 我不知道是否存在这样的情况:上一个调用堆栈帧和下一个调用堆栈帧 我尝试在编程时不使用鼠标,但当我需要返回堆栈时,我必须使用鼠标双击上一帧 有人吗?如何使用宏来执行此操作?查看工具->选项->环境->键盘。输入“堆栈”或“框架”,相关菜单将出现。似乎没有下一个和上一个调用堆栈帧。我认

Visual Studio提供了许多导航热键: F8用于当前面板中的下一项(搜索结果、错误…), 控件+K,N表示书签, Alt+-用于返回和更多

有一个热键我找不到,我甚至找不到它的菜单命令,所以我不能自己创建热键

我不知道是否存在这样的情况:上一个调用堆栈帧和下一个调用堆栈帧

我尝试在编程时不使用鼠标,但当我需要返回堆栈时,我必须使用鼠标双击上一帧


有人吗?如何使用宏来执行此操作?

查看工具->选项->环境->键盘。输入“堆栈”或“框架”,相关菜单将出现。似乎没有下一个和上一个调用堆栈帧。

我认为没有明确的下一个帧/上一个帧键绑定,但我要做的就是这样

CTRL-ALT-C已绑定到“Debug.CallStack” 这将使您在调用堆栈工具窗口中集中精力

在Callstack窗口中聚焦后。。。上下箭头将在调用堆栈帧中移动

然后我就出发了

CTRL-C、CTRL-S至“DebuggerContextMenus.CallStackWindow.SwitchToFrame” 和 CTRL-C,CTRL-C至“DebuggerContextMenus.CallStackWindow.SwitchToCode”

这两种方法都会在特定帧处将您带回“代码”窗口


希望有帮助。

我写了两个宏来获得它:
PreviousStackFrame
NextStackFrame
,并为其指定了快捷方式

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
函数StackFrameIndex(ByRef aFrames作为EnvDTE.StackFrames,ByRef aFrame作为EnvDTE.StackFrame)长度为
对于StackFrameIndex=1到aFrames.Count
如果aFrames.Item(StackFrameIndex)是aFrame,则退出函数
下一个
StackFrameIndex=-1
端函数
副导航台(ByVal aShift长度相同)
如果DTE.Debugger.CurrentProgram为空,则
DTE.StatusBar.Text=“当前未调试任何程序。”
出口接头
如果结束
Dim ind As Long=StackFrameIndex(DTE.Debugger.CurrentThread.StackFrames,DTE.Debugger.CurrentStackFrame)
如果ind=-1,那么
DTE.StatusBar.Text=“堆栈导航失败”
出口接头
如果结束
ind=ind+aShift
如果ind DTE.Debugger.CurrentThread.StackFrames.Count,则
DTE.StatusBar.Text=“堆栈帧索引超出范围”
出口接头
如果结束
DTE.Debugger.CurrentStackFrame=DTE.Debugger.CurrentThread.StackFrames.Item(ind)
DTE.StatusBar.Text=“堆栈帧索引:”&ind&“of”&DTE.Debugger.CurrentThread.StackFrames.Count
端接头
子帧()
导航舱(1)
端接头
子NextStackFrame()
导航堆栈(-1)
端接头

我已经用解决了这个问题。我几个月前做的。 假设您想要使用Control+1和Control+2,并且Control+Alt+C绑定到显示调用堆栈窗口:

^1::SendInput !^c{down}{enter}
^2::SendInput !^c{up}{enter}

它似乎工作得很好。如果您还没有使用自动热键向Visual Studio显示谁是老板,请试一试。你的问题表明你会从中受益匪浅。它改变了游戏规则。祝你好运。

非常感谢@Oleg Svechkarenko的回答,他的回答为我制定此解决方案提供了一个起点。由于VisualStudio的现代版本不再有官方的宏支持,这应该适合那些使用该插件的人,但可能可以很容易地适应任何其他宏扩展

下面是该命令的代码,我创建了一个用于向上导航调用堆栈的代码,另一个用于向下导航,除了传递给
MoveStackIndex()
的参数外,其他代码都相同,然后将键盘快捷键绑定到它们:

使用EnvDTE;
使用EnvDTE80;
使用制度;
公共类C:VisualCommand.ICommand
{
枚举移动方向
{
向上的
下来,,
}
私有bool IsValidFrame(堆栈帧)
{
字符串语言=frame.language;
布尔结果=(语言=“C#”|
语言==“C++”|
语言==“VB”| |
语言==“Python”);
返回结果;
}
私有void MoveStackIndex(EnvDTE80.DTE2 DTE,MoveDirection)
{
StackFrame currentFrame=DTE.Debugger.CurrentStackFrame;
bool foundTarget=false;
布尔电流=假;
StackFrame lastValid=null;
foreach(DTE.Debugger.CurrentThread.StackFrames中的StackFrame)
{
bool isCurrent=帧==当前帧;
如果(方向==MoveDirection.Down)
{
if(isCurrent)
{
if(lastValid==null)
{
//此帧下没有有效帧
打破
}
其他的
{
DTE.Debugger.CurrentStackFrame=lastValid;
foundTarget=true;
打破
}
}
其他的
{
if(IsValidFrame(frame))
{
lastValid=帧;
}
}
}
如果(方向==MoveDirection.Up&&passcurrent)
{
if(IsValidFrame(frame))
{
DTE.Debugger.CurrentStackFrame=帧;
foundTarget=true;
打破
}               
}
if(isCurrent)
{
pastCurrent=true;
}
}
如果(!foundTarget)
{
DTE.StatusBar.Text=“未能在该方向找到有效的堆栈帧。”;
}
}
公共无效运行(EnvDTE80.DTE2 DTE,Microsoft.VisualStudio.Shell.Package)
{
if(DTE.Debugger.CurrentProgram==null)
{
DTE.StatusBar.Text=”