2017-07-18 25 views
2

我使用Visual Studio代码定期使用PowerShell进行开发。我经常会通过点击F8(又名运行选择)来测试一行代码。但是,如果我从集成终端底部向上滚动,则打到F8不会导致集成终端向下滚动到其缓冲区末尾。运行PowerShell时跳转到集成终端的底部

当我执行运行选择命令时,如何使用PowerShell扩展配置VSCode跳转到集成终端缓冲区的末端?

+0

半相关,但如果您使用powershell_ise,则可以使用'CTRL + D'跳转到控制台窗格并使用'CTRL + I'跳转到脚本窗格 – TheIncorrigible1

回答

3

我没有看到内置的方式来做到这一点,但您应该可以使用macros extension。下面添加到的settings.json结束:

"macros": { 
    "PowerShellRunSelection": [ 
    "workbench.action.terminal.scrollToBottom", 
    "PowerShell.RunSelection" 
    ] 
} 

然后一键绑定添加到keybindings.json如下:

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

这里是我的两个F5和F8

settings.json

"macros": { 
    "PowershellRunSelection": [ 
     "workbench.action.terminal.scrollToBottom", 
     "PowerShell.RunSelection" 
    ], 
    "PowershellRun": [ 
     "workbench.action.terminal.scrollToBottom", 
     "workbench.action.debug.start" 
    ] 
} 
设置

keybindings.json

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