如何在 vscode 中触发文档弹出窗口

How to trigger documentation popup in vscode

如何在光标下触发带有标识符文档的弹出窗口? 通常它会在使用鼠标指针悬停在标识符上时出现:

我想使用命令或键盘快捷键实现此效果。

我发现的唯一相关命令是:trigger completion(不显示函数文档)和 trigger parameters hint(仅当光标位于函数调用 - 参数列表中时才有效)。

这是editor.action.showHover命令。默认绑定cmdk cmdi .

注意:快捷方式通过按住 cmd [ctrl 在 windows],然后按住 k 然后 i

您可以 change the keyboard shortcut 使用如下键绑定:

{
    "key": "cmd+k ctrl+space",
    "command": "editor.action.showHover",
    "when": "editorTextFocus"
}

你也有, VSCode 1.40 (Oct. 2019):

Definition Preview Hover from the keyboard

There is a new command Show Definition Preview Hover for better accessibility of the definition preview hover widget, which can be triggered by hovering a symbol with the mouse and pressing a modifier key dependent on the platform and configuration.

Previously, only the command Show Hover was provided, which is equivalent to hovering the mouse cursor over a symbol.
Now, with Show Definition Preview Hover, the detailed hover information can be shown via the keyboard.

在 Visual Studio 2019 for Mac,我在键绑定设置中找不到任何关于 "hover" 的信息。相关命令好像叫"Show quick info",默认绑定到Cmd + F1.

我知道这个问题是关于 VSCode 的,但我只是在尝试搜索答案时才找到这个问题。因此,我也想在这里留下信息,以防有人觉得有用。

触发参数提示的默认快捷键是Ctrl+Shift+Space

要使其更加生动,请检查以下步骤:

有多种方法可以触发文档弹出窗口:

首先: 使用快捷键 ctrl + space

第二个: 使用 vscode 扩展名:

这是文档: