VS Code - 通过键盘跳转到当前调试位置

pan*_*ter 8 debugging keyboard-shortcuts visual-studio-code vscode-settings

在VS Code中,如何跳转到调试器的当前位置?它由一条淡黄色的线表示,但我倾向于在浏览其他文件和功能时迷失方向,只能努力找到返回调试会话当前暂停的位置的方法。

应该足够简单,但我在文档中找不到任何内容。我什至经历了键盘映射中包含“调试”的所有操作,但没有找到我要找的东西。

pan*_*ter 16

可以通过单击(或使用键盘选择)“调用堆栈”视图中最上面的条目来实现所需的效果(跳转到当前执行点)。

使用多命令宏扩展(受Mark 的回答启发),可以创建自定义命令,该命令将始终选择调用堆栈视图中的最顶部条目。

这适用于您的keybindings.json

{
    "key": "cmd+f4",
    // Go to current debugging position
    "command": "extension.multiCommand.execute",
    "args": {
      "sequence": [
        "workbench.debug.action.focusCallStackView",
        "list.clear",
        "list.focusFirst",
        "list.select"
        // optional, to focus your editor:
        // workbench.files.action.focusOpenEditorsView
      ]
    }
},
Run Code Online (Sandbox Code Playgroud)


Cod*_*lue 7

快速添加键盘快捷键以跳转到 VS Code 中的当前调试位置

基于VonC 的答案,特别是使用当前版本的 VS Code 1.71.0:

  1. 键入ctrl-k ctrl-s以访问键盘快捷键。

  2. 在搜索框中键入“callstack”并找到“导航到调用堆栈顶部”。

  3. 设置键绑定,例如,我使用ctrl-r d

在此输入图像描述

  1. 试试看!现在当我打字时ctrl-r d我就在那里!