如何在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. 进入键盘映射菜单后,只需搜索快速文档。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值