我正在嘗試將 R 的自定義快捷方式添加到我的 VS 代碼設定中。我|>通過將以下內容添加到我的鍵盤快捷鍵 json 檔案中,為編輯器寡婦設定了管道運算子的快捷方式。
{
"key": "ctrl shift m",
"command": "type",
"when": "editorLangId == r && editorTextFocus",
"args": {"text": " |> "}
}
但是,此快捷方式不適用于終端。我認為when上面塊中的論點看起來像terminalLangId == r && terminalTextFocus. 但是,這些引數(例如,terminalLangId)似乎并不是 VS 代碼使用的實際引數。
誰能提供有關如何在 VS 代碼中為終端設定語言特定鍵盤快捷鍵的建議?
uj5u.com熱心網友回復:
要將文本發送到終端,您可以使用不同的命令,workbench.action.terminal.sendSequence.
{
"key": "ctrl shift m",
"command": "type",
"when": "editorLangId == r && editorTextFocus",
"args": {"text": " |> "}
},
{
"key": "ctrl shift m",
"command": "workbench.action.terminal.sendSequence",
"when": "terminalFocus",
// "when": "editorLangId == r && terminalFocus", // maybe you want this?
"args": {"text": " |> "}
}
這將|>在當前編輯器具有焦點時輸入,如果它是一個r檔案。或者,如果終端有焦點,|>將在那里列印。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/533638.html
標籤:视觉工作室代码
