在Eclipse中,当鼠标悬停在一个方法、变量等上时,会显示一个带有相应JavaDocs的工具提示。IntelliJ中有这样的特性吗?


当前回答

从IntelliJ Ultimate 2018.1.5,也就是IntelliJ IDEA 2018.1.5,到2019.3,在File -> Preferences下实际上有两个选项:

In Editor > General > Other (section) > Show quick documentation on mouse move - delay 500 ms Select this check box to show quick documentation for the symbol at caret. The quick documentation pop-up window appears after the specified delay. In Editor > General > Code Completion (sub-item) > Auto-display documentation in 1000 ms Select this check box to have IntelliJ IDEA automatically show a pop-up window with the documentation for the class, method, or field currently highlighted in the lookup list. If this check box is not selected, use Ctrl+Q to show quick documentation for the element at caret. Quick documentation window will automatically pop up with the specified delay in those cases only, when code completion has been invoked explicitly. For the automatic code completion list, documentation window will only show up on pressing Ctrl+Q.

其他回答

对于IntelliJ 13,在IDE设置的编辑器页面中有一个复选框

编辑:对于IntelliJ 14,该选项已移动到Editor > General页面。这是“其他”组的最后一个选项。(对于Mac来说,该选项在菜单“IntelliJ Idea”>“Preferences”下)。

编辑:对于IntelliJ 16,它是编辑器> General > Other中的倒数第二个选项。

编辑:对于IntelliJ终极2016.1,它已被移动到编辑器>通用>代码完成。

编辑:对于IntelliJ Ultimate 2017.2,也就是IntelliJ IDEA 2017.2.3,实际上有两个选项:

在编辑器>一般>其他(部分)>显示鼠标移动的快速文档-延迟500毫秒

选中此复选框可显示插入符号的快速文档。在指定的延迟之后,将出现快速文档弹出窗口。

在编辑器> General > Code补全(子项)> Autopopup文档中,用于显式调用补全

Select this check box to have IntelliJ IDEA automatically show a pop-up window with the documentation for the class, method, or field currently highlighted in the lookup list. If this check box is not selected, use Ctrl+Q to show quick documentation for the element at caret. Quick documentation window will automatically pop up with the specified delay in those cases only, when code completion has been invoked explicitly. For the automatic code completion list, documentation window will only show up on pressing Ctrl+Q.

编辑:对于IntelliJ Ultimate 2020.3,第一个选项现在位于编辑器>代码编辑>快速文档>显示鼠标移动时的快速文档

上面所有的方法都很有用,但是有一个基本的东西你需要在你的JDK中有src.zip (C:\Program Files\Java\jdk1.8.0_171)。我以为它是预装的,但出于某种原因,它没有出现在我的安装。另一件需要检查的事情是,您的项目是否使用指定的JDK(在本例中为1.8.0_171)。

至少对我来说,最简单的方法是:

Ctrl + Shift +一个 类型:show document 显示鼠标移动时的快速文档(设置为on)

在Intellij13中,你可以像下面这样使用编辑器配置:

文件- >设置- >编辑器

选中“在鼠标上显示快速文件”

现在,当您将鼠标放在一个方法上时,将出现一个带有文档的工具提示。有时工具提示的大小太小,你将不得不调整它移动鼠标到工具提示的底部。