如何在IntelliJ IDEA中查看JavaDoc? [重複]

本文翻譯自:How to see JavaDoc in IntelliJ IDEA? [duplicate]

This question already has an answer here: 這個問題已經在這裏有了答案:

I just switched from Eclipse to IntelliJ. 我只是從Eclipse切換到IntelliJ。 IntelliJ lacks one feature from Eclipse - when you put your mouse over a method, Eclipse shows javadoc info. IntelliJ缺少Eclipse的一項功能-當您將鼠標放在某個方法上時,Eclipse會顯示javadoc信息。 I think the way to show it is to use a shortcut - command + J , but when I click it, I get something wrong as on the screen shot below. 我認爲顯示它的方法是使用快捷鍵-command + J ,但是當我單擊它時,出現如下屏幕截圖所示的錯誤。 Please advise me on how I can quickly get javadoc information. 請爲我提供有關如何快速獲取javadoc信息的建議。 I need to at least know what type a method returns. 我至少需要知道方法返回的類型。

在此處輸入圖片說明


#1樓

參考:https://stackoom.com/question/kNQW/如何在IntelliJ-IDEA中查看JavaDoc-重複


#2樓

Use View | 使用View | Quick Documentation or the corresponding keyboard shortcut (by default: Ctrl + Q on Windows/Linux and Ctrl + J on macOS or F1 in the recent IDE versions). 快速文檔或相應的鍵盤快捷方式(默認情況:在Windows / Linux上爲Ctrl + Q ,在最新IDE版本中爲macOS或F1Ctrl + J )。 See the documentation for more information. 請參閱文檔以獲取更多信息。

It's also possible to enable automatic JavaDoc popup on explicit (invoked by a shortcut) code completion in Settings | 也可以在Settings | Settings |“ 顯式”中完成自動的JavaDoc彈出窗口(由快捷方式調用)。 Editor | Editor General | General Code completion ( Autopopup documentation ): Code completion (自動彈出文檔 ):

自動彈出文件

Yet another way to see the quick doc is on mouse move : 查看快速文檔的另一種方法是鼠標移動

鼠標移動


#3樓

Alternatively you can position your cursor on the item and show JavaDoc using 或者,您可以將光標放在該項目上,並使用來顯示JavaDoc

CTRL + Q CTRL + Q

which is the default shortcut. 這是默認的快捷方式。

Edit: As Methical mentioned on Mac the shortcut is 編輯:如Mac上提到的Methical,快捷方式是

CTRL + j ( ^ + j not + j ) CTRL + j^ + j不是 + j


#4樓

There is nice feature which shows quick documentation when your mouse is over element. 有一個不錯的功能,當鼠標懸停在元素上時,它可以顯示快速文檔。

IntelliJ 14 IntelliJ 14

Editor / General -> Show quick documentation on mouse move 編輯器/常規->顯示有關鼠標移動的快速文檔

Older versions 舊版本

Add the following line to idea.properties file: 將以下行添加到idea.properties文件:

auto.show.quick.doc=true

#5樓

Go to File/Settings , Editor , click on General . 轉到File/SettingsEditor ,單擊General

Scroll down, then ✔ Show quick documentation on mouse move . 向下滾動,然後✔ Show quick documentation on mouse move

在此處輸入圖片說明


#6樓

To best mirror Eclipses functionality, enable the following settings: 爲了最好地反映Eclipse的功能,請啓用以下設置:

  • IDE Settings/Editor -> Other.Show quick doc on mouse move IDE設置/編輯器 -> 其他。在鼠標移動時顯示快速文檔
  • IDE Settings/Editor/Code Completion -> Autopopup Documentation IDE設置/編輯器/代碼完成 -> 自動彈出文檔

To see the javadoc in the autocomplete menu, hit '.' 要在自動完成菜單中查看javadoc,請點擊“。”。 to get the popup, then hover over the object you are working with, once you get the javadoc popup, you can select an item in the popup to switch the javadoc over. 要獲取彈出窗口,然後將鼠標懸停在要使用的對象上,一旦獲得javadoc彈出窗口,就可以在彈出窗口中選擇一個項目來切換javadoc。 Not ideal... But its something. 不理想...但是有一些東西。

As another note. 另請注意。 The search functionality of the options menu is very useful. 選項菜單的搜索功能非常有用。 Just type in 'doc' and you will see all the options for doc. 只需輸入“ doc”,您將看到doc的所有選項。

Also, searching for "autopopup doc" will not only find each of the options, but it will also highlight them in the menu. 另外,搜索“ autopopup doc”不僅會找到每個選項,還會在菜單中突出顯示它們。 Pretty awesome! 太棒了!


Edit: Going beyond the initial question, this might be useful for people who just want quick and easy access to the docs. 編輯:超出最初的問題,這對於只想快速輕鬆地訪問文檔的人可能有用。

After using this for a few more days, it seems just getting used to using the hotkey is the most efficient way. 在使用了幾天之後,似乎習慣於使用熱鍵纔是最有效的方法。 It will pop up the documentation for anything at the spot of where your text input marker is so you never have to touch the mouse. 它將在文本輸入標記所在的位置彈出任何內容的文檔,因此您無需觸摸鼠標。 This works in the intellisense popup as well and will stay up while navigating up and down. 這同樣適用於智能感知彈出窗口,並且在向上和向下導航時將保持向上。

Personally, Ctrl+Q on windows was not ideal so I remapped it to Alt+D. 就個人而言,Windows上的Ctrl + Q並不理想,因此我將其重新映射爲Alt + D。 Remaping can be done under IDE Settings/Keymap. 可以在IDE設置/鍵盤映射下完成重新映射。 Once in the keymap menu, just search for Quick Documentation. 進入鍵盤映射菜單後,只需搜索快速文檔。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章