如何通过快捷方式打开灯泡? [英] How to open the lightbulb via shortcut?
问题描述
某些语言支持显示灯泡的代码操作,可为警告/错误提供快速修复(请参见 https: //code.visualstudio.com/docs/editor/editingevolved#_code-action 了解更多信息). 我喜欢此功能,但不喜欢单击灯泡.不幸的是,我找不到在当前光标位置打开灯泡的快捷方式. 如何创建这样的快捷方式?
Some languages support code actions which display a lightbulb providing quick fixes for a warning/error (See https://code.visualstudio.com/docs/editor/editingevolved#_code-action for more information). I like this feature but I don't like to click on the lightbulb. Unfortunately I can't find a shortcut for opening the lightbulb at the current cursor position. How can I create such a shortcut?
我试图通过创建这样的自定义按键绑定来为vscode.executeCodeActionProvider
创建快捷方式:
I tried to create a shortcut for vscode.executeCodeActionProvider
by creating a custom keybinding like this:
[{ "key": "alt+enter", "command": "vscode.executeCodeActionProvider"}]
但是每次我按下快捷方式时,都会收到警告
But everytime I hit the shortcut I receive the warning
运行贡献的命令:'vscode.executeCodeActionProvider'失败.
Running the contributed command:'vscode.executeCodeActionProvider' failed.
推荐答案
正确的命令editor.action.quickFix
. Windows上的默认绑定如下所示:
The correct command editor.action.quickFix
. The default binding on Windows looks like this:
{ "key": "ctrl+.", "command": "editor.action.quickFix",
"when": "editorTextFocus" }
在Mac上为 CMD + ..
这篇关于如何通过快捷方式打开灯泡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!