Search code examples
intellij-idea

How to quickly find the fully qualified name of a class in IntelliJ?


I been giving IntelliJ a spin, and loving it so far. But, I got a question, is there any way of quickly getting the fully qualified name of a class from within the editor?

So, if I have some code like

Element element = new Element();

I could quickly get the fully qualifed name of Element, for example, com.whatever.Element


Solution

  • Ctrl and hover (or and hover)

    If I hold Ctrl and hover over the class name Element with my mouse, I get a popup with the following information (assuming Element extends AbstractElement and implements IElement):

    [intellij-module-name] com.whatever
    public class Element extends AbstractElement
    implements IElement
    

    The package name after the module name on the first line, plus the name of the class itself, would give you the fully-qualified name in your head. You can also Ctrl+Left Click on the Element class name to jump to its definition, where you could copy out the package declaration from the file if you need the actual text in the editor for whatever reason.

    For macOS, hold while hovering mouse pointer.