ChatGPT解决这个技术问题 Extra ChatGPT

IntelliJ show JavaDocs tooltip on mouse over

In Eclipse, when hovering over a method, variable, etc. a tooltip is displayed with the corresponding JavaDocs. Is there such a feature in IntelliJ?

You can put the cursor inside the method/variable and press ctrl+q (on PC) or ctrl+j (on mac).
Should be nice to have that popup while typing the parameters...
I am still unable to see this after enabling as mentioned below for 2017.1 EAP. I even restarted and nada, I hovered for long.
In case none of the answers are working, make sure that you're not still in a debugging session by accident, which was the case for me.

P
Per Lundberg

For IntelliJ 13, there is a checkbox in Editor's page in IDE Settings

https://i.stack.imgur.com/K0Z2p.jpg

EDIT: For IntelliJ 14, the option has been moved to Editor > General page. It's the last option in the "Other" group. (For Mac the option is under the menu "IntelliJ Idea" > "Preferences").

EDIT: For IntelliJ 16, it's the second-to-last option in Editor > General > Other.

https://i.stack.imgur.com/mZTMg.png

EDIT: For IntelliJ Ultimate 2017.2, aka IntelliJ IDEA 2017.2.3, there are actually two options:

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) > Autopopup documention in 1000 ms, for explicitly invoked completion

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.

EDIT: For IntelliJ Ultimate 2020.3, the first option is now located under Editor > Code Editing > Quick Documentation > Show quick documentation on mouse move


This worked perfectly for me, and was exactly what I was looking for when I googled my issue. This seems to be the most up-to-date solution.
File/Settings | IDE Settings / Editor. Check "Show quick doc on mouse move"
Thanks it works on 13.1 but Jesus, that is not intuitive at all.
Can anyone comment on why this isn't enabled by default? I thought that IntelliJ simply didn't have the feature. It should be opt-out, enabled by default.
The problem is, it doesn't STICK! As soon as I move the mouse away, it disappears. This is unlike Eclipse, where I can move into the doc pop-up and make it stick - very useful for reading longer docs and navigating. How can I get IntelliJ doc pop-up to stick?! Starting to hate the fact that Android Studio is now official...
B
Bart Kiers

Up until IntelliJ version 11, no, not just by hovering over it. If the cursor is inside the method- or attribute name, then CTRL+Q will show the JavaDoc on *nix and Windows. On MacOSX, this is CTRL+J.

Quote: "No, the only way to see the full javadoc is to use Quick Doc (Ctrl-Q)." -- http://devnet.jetbrains.net/thread/121174

EDIT

Since IntelliJ 12.1, this is possible. See @ADNow's answer.


Thanks, I'd rather use the keyboard than mouse hovers.
A
AFD

It is possible in 12.1.

Find idea.properties in the BIN folder inside of wherever your IDE is installed, e.g. C:\Program Files (x86)\JetBrains\IntelliJ\bin

Add a new line to the end of that file:

auto.show.quick.doc=true

Start IDEA and just hover your mouse over something:

https://i.stack.imgur.com/Itwst.png


This worked perfectly for me in 12.1.5 Ultimate, but is there a way to change this exposed in the settings menu?
This does not do anything in my 133.79 Beta on Linux.
Any idea why I am not getting Syntax highlighting in the documentation popup? stackoverflow.com/q/23086511/238768
I
Ilya

After doing CTRL+Q, you can

Pin the tooltip (top right corner) Check Docked Mode (under gear in top right after pinning) Size as desired Click icon for Auto show documentation for selected item

Then when you move your cursor, the documentation will appear in this box. It costs you a little screen real estate, but I find it's worth it.

I'd post a screenshot but SO won't let me post images.


Thank you, this is very useful for me
f
fedorqui

For Intellij 15, use the checkbox in File > Settings > Editor > General option Show quick documentation on mouse move.

https://i.stack.imgur.com/3JJ8A.png

You can also get there by typing "quick" or something similar in the search box:

https://i.stack.imgur.com/gUrkt.png


This one works. But what "Autopopup documentation in in(ms)" in other answers stands for?
@Serob_b I am not sure what you mean here.
In my version of Intellij (2017.1.3) there is an option that you are talking about, but also "Autopopup documentation in(ms):" option in Editor > General > Code Completion (as accepted answer informs). So, what is the difference between these two? Just checking the second one (Autopopup) didn't solve the problem.
Thanks. I've actually figured out that "Autopopup documentation in (ms)" is for ctrl + space and has nothing to do with mouse hover, and of course "Show quick documentation on mouse move" is what shows docs on hover. In Intellij 2017
M
Matthew Chen

https://i.stack.imgur.com/X3LmL.png


In terms of getting exactly the same UX as eclipse, this looks like the best answer to me .. thanks !
This one works. But what "Autopopup documentation in in(ms)" in other answers stands for?
J
James Graham

https://i.stack.imgur.com/1SV0h.png

https://i.stack.imgur.com/rsPEf.png


m
meoww-

Adding on to what ADNow said. On the Macintosh:

Right click on IntelliJ IDEA 12 Click on the Show Package Contents menu option Open the bin folder Open idea.properties Add the line: auto.show.quick.doc=true


P
Paul Roub

The easiest way, at least for me, was:

Ctrl+Shift+A

Type: show document

Show quick documentation on mouse move (set it to ON)


L
Leviand

From IntelliJ Ultimate 2018.1.5, aka IntelliJ IDEA 2018.1.5, till 2019.3 , there are actually two options under 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.


J
Jonas Pedersen

In IntelliJ IDEA 14, it has moved to: File -> Settings -> Editor -> General -> "Show quick doc on mouse move"


S
Slimane Deb

In Intellij 2019, I did: File > Settings > Editor > General option Show quick documentation on mouse move.


what do you mean ?
This is the answer for 2019.3. I love playing hide-and-seek with this feature every major release! Thank you JetBrains <3
@MattStephenson now to find it again for 2020.2 >_<
A
Amap

File-->Settings-->Editor

Check "Show quick doc on mouse"

Now when you put the mouse over a method a tooltip with the documentation will appear. Sometimes the tooltip size is too small and you will have to resize it moving the mouse down to the bottom of the tooltip.


C
Cjkjvfnby

IDEA has "find action":

Open "Help" menu, type "doc", move cursor to "Quick Documentation" it will be highlighted.

Also "find action" can be called from hot key (you can find it in settings->hotkeys)


G
Gemtastic

On mac in IntelliJ Ultimate (trial) 14 I have mine under Settings > Editor > General > Code completion. The tooltip short is F1 on my laptop.

It's called "Autopopup documentation in (ms):"

https://i.stack.imgur.com/Ow0P3.png


This does not show docs, just the possible method invocation and their parameter types.
how do you "explicitly invoke completion"
I don't understand what you mean by that
This is just code completion with types right? No doc info?
It's supposed to show the JavaDoc, it does for me. The JavaDoc window will popup after 1000ms, now you may have to have a look at where it pops up. Sometimes it pops up as a tab in the right toolbar by the maven tab.
o
ozzylee

A note for Android Studio (2.3.3 at least) users, because this page came up for my google search "android studio hover javadoc", and android studio is based on Intellij:

See File->Settings->Editor->General: "show quick documentation on mouse moves", rather than File->Settings->Editor->General->Code Completion "Autopopup documentation in (ms) for explicitly invoked completion" and "Autopopup in (ms)", which has been previously talked about.


P
Praveen Tiwari

I tried many ways mentioned here, especially the preference - editor - general - code completion - show documentation popup in.. isn't working in version 2019.2.2

Finally, i am just using F1 while caret is on the type/method and it displays the documentation nicely. This is not ideal but helpful.


s
s7vr

In 2020.1 there is in editor javadocs rendering has been added. Screen shots borrowed from intellij documentation.

https://i.stack.imgur.com/dfzGp.png

https://i.stack.imgur.com/0u3Me.png

https://i.stack.imgur.com/FyJHL.png


M
Michal

On my IntelliJ U on Mac I need to point with cursor on some method, variable etc. and press [cntrl] or [cmd] key. Then click on the link inside popup window which appeared to see JavaDocs


a
avp

All of the above methods are useful but one basic thing missing you need to have src.zip in your JDK (C:\Program Files\Java\jdk1.8.0_171). I assumed it comes preinstalled but for some reason, it was not present in my installation. Another thing to check is if your project is using the specified (1.8.0_171 in this case) JDK.


C
Cœur

The answer is CTRL + P (NOT CTRL + Q)

Someone else posted this answer on JetBrains forum: The idea is a different IDE. Try to discover its features and try to make the best of it, rather than trying to emulate whatever you used before. For the most part, Idea has very high usability (much better than Eclipse IMHO) and is streamlined for supporting code editing as best as possible (rather than relying on wizards too much for example).

Javadoc: Ctrl-Q

A quick view of the implementation: Ctrl-Shift-I

Show context: Alt-Q

Show parameters (in a method call): Ctrl-P

Show error description. Ctrl-F1

... plus many more shortcuts to navigate in code and different idea views.

I think it rather nice that you can see just the specific bit of information you are interested in with a simple keystroke. Have a look at the menus which will also show the possibly modified shortcuts for your keymap.

0 Avatar Jens Voß Created June 12, 2008, 09:26 And, elsandros, in addition to what Stephen writes: Since you seem to be interested in IDEA's keyboard shortcuts, I highly recommend the "Key Promoter" plugin which helps you memorize the relevant shortcuts quickly.

Also very useful is the "Goto Action" feature, invoked by Ctrl-Shift-A. In the popup, you can enter a keyword (e.g. "Javadoc"), and the IDE tells you the available actions matching your search, along with keyboard shortcuts and the containing action groups (which often also give you a clue about how to navigate to the action using the menu).


The best answer is: eg. Mercedes Sara= new Mercedes(); 1. put your cursor in (). 2. Press ctrl + P 3. Press alt + P result: now all variables are auto-formatted and you can type the values while reading the variables. (build 2018)
Disagree that this is the best answer. The question was for a mouse hover over a symbol, which is provided OOTB in Eclipse. What I typically find is that I'm interested in something that's on the screen, but not under the cursor. So, to move the cursor to the symbol (mouse movement), type a short cut (keyboard), and then mouse back to where I was editing (another mouse movement) is too much work. A single mouse movement to get the information I need is perfect, as I can resume typing immediately.