Basil Bourque
Basil Bourque

Reputation: 338181

Show source code for selected class name in editor in IntelliJ 2018.1

Through Maven, I have the source code and JavaDoc both downloaded for libraries used by my code.

I want to select a class name called in my code in the IntelliJ code editor, and then ask IntelliJ to show me the source code for that particular class.

Bonus: Show the JavaDoc for that class.

I thought F1 key would do this, but no so.

If a keyboard shortcut is required, please indicate the macOS version as well as the PC version if known.

Upvotes: 4

Views: 1304

Answers (3)

Shivani
Shivani

Reputation: 1

COMMAND+B is used to show source code after selecting the class or interface for IntelliJ Users.

Upvotes: 0

Basil Bourque
Basil Bourque

Reputation: 338181

Hold Command key, hover mouse, and click

On a Mac, hold down the Command key. Notice as you move the mouse pointer, the class names change to blue underscored text like an old-school web page link. Click that retro-link while holding down Command.

I am guessing, per comment by Justice, that on a PC you would hold down Control key while hovering/clicking.

No need to select the class name.

Before, no keys pressed

enter image description here

After, pressing Command while hovering mouse pointer

enter image description here

Click the apparent link to open the local copy of class source code.

This approach worked on IntelliJ 2018.1 on macOS Sierra.

Upvotes: 2

Mureinik
Mureinik

Reputation: 310993

Pressing CTRL+N will open a text box where you can search for the class by name, and then open it, regardless of whether it's a class that's part of your project's sources or a library you use. If you have the library's source downloaded, IntelliJ IDEA will show you that instead of the decompiled binary of the class.

Upvotes: 1

Related Questions