运行PowerShell时跳到集成终端的底部

运行PowerShell时跳到集成终端的底部,powershell,visual-studio-code,Powershell,Visual Studio Code,我经常使用VisualStudio代码与PowerShell一起开发。我经常会通过点击F8(又名runselection)来测试一行代码。但是,如果我从集成终端的底部向上滚动,点击F8不会导致集成终端向下滚动到其缓冲区的末尾 当我执行Run Selection命令时,如何配置带有PowerShell扩展的VSCode以跳转到集成终端缓冲区的末尾?我看不到一种内置方法来实现这一点,但您应该能够使用。将以下内容添加到settings.json的末尾: "macros": { "PowerShel

我经常使用VisualStudio代码与PowerShell一起开发。我经常会通过点击F8(又名runselection)来测试一行代码。但是,如果我从集成终端的底部向上滚动,点击F8不会导致集成终端向下滚动到其缓冲区的末尾


当我执行Run Selection命令时,如何配置带有PowerShell扩展的VSCode以跳转到集成终端缓冲区的末尾?

我看不到一种内置方法来实现这一点,但您应该能够使用。将以下内容添加到
settings.json
的末尾:

"macros": {
  "PowerShellRunSelection": [
    "workbench.action.terminal.scrollToBottom",
    "PowerShell.RunSelection"
  ]
}
然后向
keybindings.json
添加一个keybinding,如下所示:

{
  "key": "f8",
  "command": "macros.PowerShellRunSelection",
  "when": "editorTextFocus && editorLangId == 'powershell'"
}

这是我对f5和f8的设置

settings.json

"macros": {
    "PowershellRunSelection": [
        "workbench.action.terminal.scrollToBottom",
        "PowerShell.RunSelection"
    ],
    "PowershellRun": [
        "workbench.action.terminal.scrollToBottom",
        "workbench.action.debug.start"
    ]
}
{
    "key": "f8",
    "command": "macros.PowershellRunSelection",
    "when": "editorTextFocus && editorLangId == 'powershell'"
},
{
    "key": "f5",
    "command": "macros.PowershellRun",
    "when": "editorTextFocus && editorLangId == 'powershell'"
}
keybindings.json

"macros": {
    "PowershellRunSelection": [
        "workbench.action.terminal.scrollToBottom",
        "PowerShell.RunSelection"
    ],
    "PowershellRun": [
        "workbench.action.terminal.scrollToBottom",
        "workbench.action.debug.start"
    ]
}
{
    "key": "f8",
    "command": "macros.PowershellRunSelection",
    "when": "editorTextFocus && editorLangId == 'powershell'"
},
{
    "key": "f5",
    "command": "macros.PowershellRun",
    "when": "editorTextFocus && editorLangId == 'powershell'"
}

半相关,但如果使用powershell ise,则可以使用
CTRL+D
跳转到控制台窗格,也可以使用
CTRL+I
跳转到脚本窗格