Visual Studio Code 为右键单击菜单按钮创建按键绑定
例如,在 VS Code 中,我可以右键单击变量,选择 Peek >查看类型定义。
我怎样才能为此创建一个键绑定(目前没有键绑定集)?如果“查看类型定义”按钮未映射到任何内容,我怎样才能找到 keybindings.json 文件的适当命令?
For example, in VS Code, I can right click on a variable, select Peek > Peek Type Definition.
How can I make a keybinding for this (currently there is no keybinding set)? How can I even find the appropriate command for the keybindings.json file, if the "Peek Type Definition" button is not mapped to anything?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
转到右下角的齿轮图标。单击它并选择
键盘快捷键
。它将打开键盘快捷键编辑器。在该编辑器顶部的输入框中,输入
peek type
,您将看到显示 2 个条目。一是:该命令没有默认快捷方式,但您可以自己创建一个。
如果将鼠标悬停在该条目上,其左侧将出现一个
+
符号,单击它,将打开一个输入对话框,您可以在其中输入您选择的键绑定。它将在您的
keybindings.json
中创建一个键绑定,例如Go to the Gear Icon in the lower right. click it and select
Keyboard Shortcuts
. It will open the Keyboard Shortcuts editor.In that editor's input box at the top, type
peek type
and you will get 2 entries shown. One is:That command does not have a default shortcut, but you can make one yourself.
If you hover over that entry, a
+
sign will appear to its left, click it and an input dialog opens where you can enter your chosen keybinding.It will make a keybinding in your
keybindings.json
like当您右键单击时,弹出的窗口称为上下文菜单。有些键盘有上下文菜单按钮。不幸的是,VSCode 不使用此命令作为键盘快捷键中的命令,因此无法通过键盘快捷键菜单来执行此操作。
或者,您可以使用 SharpKeys,这是一个可以让您重新映射按键的实用程序在你的键盘上。就我个人而言,我将右侧 Alt 键映射到上下文菜单按钮。在 SharpKeys 中,上下文菜单按钮没有名称,因此仅称为
特殊:应用程序 (E0_5D)
。这允许您从键盘上右键单击。在下面的屏幕截图中,您可以在突出显示的部分中看到重新映射。
When you right click, the window that pops up is called the context menu. Some keyboards have a context menu button. Unfortunately, VSCode does not use this as the command in the keyboard shortcuts, so there is no way to do this through the keyboard shortcuts menu.
Alternatively, you could use SharpKeys, a utility that lets you remap keys on your keyboard. Personally, I have my right alt key mapped to the context menu button. In SharpKeys, the context menu button does not have a name, so it is just called
Special: Application (E0_5D)
. This allows you to right click from the keyboard.In the screenshot below, you can see the remap in the highlighted section.
相当于用鼠标右键单击编辑器面板中的符号,有一个键盘快捷键
“在 textInputfocus 上显示编辑器上下文菜单”。
默认绑定是 [shift]+f10。
这将打开右键菜单,您可以使用箭头导航到菜单项。
强文本
The equivalent of right-clicking with a mouse a symbol in an editor panel has a keyboard shortcut
'Show Editor Context Menu on textInputfocus'
The default binding is [shift]+f10.
This will open the right-click menu, and you can navigate with arrows to your menu item.
strong text