在 Windows 上的 VSCode 1.64.1 中,我正在嘗試創建一些用于聚焦的條件快捷方式。
當檔案資源管理器不集中時,我想ctrl 0關注活動編輯器組。當活動編輯器組被聚焦時,我想ctrl 0聚焦于資源管理器。我嘗試了以下方法,但僅部分有效。
目前,點擊ctrl 0會聚焦資源管理器,但是ctrl 0當資源管理器聚焦時再次點擊不會像期望的那樣聚焦活動編輯器組:
//keybindings.json
{
"key": "ctrl 0",
"command": "workbench.action.focusActiveEditorGroup",
"when": "!editorTextFocus"
},
{
"key": "ctrl 0",
"command": "workbench.action.focusSideBar",
"when": "!explorerFocus"
}
uj5u.com熱心網友回復:
我沒有看到explorerFocus背景關系鍵。以下確實有效:
{
"key": "ctrl 0",
"command": "workbench.action.focusActiveEditorGroup",
"when": "!editorTextFocus"
},
{
"key": "ctrl 0",
"command": "workbench.action.focusSideBar",
"when": "!filesExplorerFocus" // change here
}
顯然,當您使用不存在的背景關系鍵時,when根本不會評估該子句 - 就好像它不存在一樣。而且由于對鍵系結的評估是從檔案的底部開始的——從底部開始的第一個獲勝——你的focusActiveEditorGroup命令將永遠不會被看到。
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/427171.html
