我使用Visual Studio代碼定期使用PowerShell進行開發。我經常會通過點擊F8(又名運行選擇)來測試一行代碼。但是,如果我從集成終端底部向上滾動,則打到F8不會導致集成終端向下滾動到其緩衝區末尾。運行PowerShell時跳轉到集成終端的底部
當我執行運行選擇命令時,如何使用PowerShell擴展配置VSCode跳轉到集成終端緩衝區的末端?
我使用Visual Studio代碼定期使用PowerShell進行開發。我經常會通過點擊F8(又名運行選擇)來測試一行代碼。但是,如果我從集成終端底部向上滾動,則打到F8不會導致集成終端向下滾動到其緩衝區末尾。運行PowerShell時跳轉到集成終端的底部
當我執行運行選擇命令時,如何使用PowerShell擴展配置VSCode跳轉到集成終端緩衝區的末端?
我沒有看到內置的方式來做到這一點,但您應該可以使用macros extension。下面添加到的settings.json
結束:
"macros": {
"PowerShellRunSelection": [
"workbench.action.terminal.scrollToBottom",
"PowerShell.RunSelection"
]
}
然後一鍵綁定添加到keybindings.json
如下:
{
"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"
]
}
設置
keybindings.json
{
"key": "f8",
"command": "macros.PowershellRunSelection",
"when": "editorTextFocus && editorLangId == 'powershell'"
},
{
"key": "f5",
"command": "macros.PowershellRun",
"when": "editorTextFocus && editorLangId == 'powershell'"
}
半相關,但如果您使用powershell_ise,則可以使用'CTRL + D'跳轉到控制檯窗格並使用'CTRL + I'跳轉到腳本窗格 – TheIncorrigible1