In this section:

Basics

Any code completion or live template operation ends up with a suggestion list, from which you have to select the desired option.

IntelliJ IDEA provides handy ways to make your selection, complete the source code, sort entries, and view reference information without leaving the suggestion list.

Navigating through the suggestion lists

To navigate through the suggestion lists, use the mouse cursor or the , ⌃P, or ⌃P or , ⌃P, or ⌃PUp, or Up, ^ P, , ⌃P, or ⌃P and , ⌃N, or ⌃N or , ⌃N, or ⌃NDown, or Down, ^ N, , ⌃N, or ⌃N arrow keys.

Narrowing and widening the suggestion list

  • Use the horizontal arrow keys in the completed expression to make the suggestion list wider (left arrow) or closer (right arrow):

    lookupListHorizArrows

Completing selection

  • Use or or or Enter, or Enter, ^ M, , ⌃M, or ⌃M to insert the selected string at the insertion point.
  • Use or or or Tab, or Tab, or to replace the string next to the caret with the selected one.
  • Use ⇧⌘⏎ or ⇧⌘⏎⇧⌘⏎ or ⇧⌘⏎⇧⌘⏎ or ⇧⌘⏎^ ⇧ Enter, ⌃⇧⏎ or ⌃⇧⏎^ ⇧ Enter, ⌃⇧⏎ or ⌃⇧⏎ to make the current code construct syntactically correct (balance parentheses, add missing braces and semicolons, etc.)
  • It is possible to enter the desired element name manually when the input position is highlighted and the list of suggestions is opened. As you type, the suggestion list shrinks so that only matching element names remain:

    itar7.gif

    If you enter a name not used in scope, IntelliJ IDEA informs you with a pop-up window, as shown in the figure below:

    itar8.gif

  • It is possible to type any part of a word, even the characters located somewhere in the middle:

    codeCompletionWildcard.png

    That's why asterisk character doesn't get any special processing as a wildcard.

  • Use ! to negate a Boolean expression.

Please note the following:

  • If, invoking an action, you don’t get what you want immediately, invoke this action again by pressing the same shortcut.
  • Most suitable variants in the suggestion list are displayed on top of the list.
  • Entries in bold font on top of the list denote symbols defined in the current class. All the other symbols are shown below.

Viewing reference information in the suggestion lists

  • Use the Quick Definition View. If you select an entry in a list and press ⌥Space, ⌘Y, ⌥Space or ⌘Y⇧⌘I or ⇧⌘I⌥Space, ⌘Y, ⌥Space or ⌘Y^ ⇧ I, ⌃⇧I or ⌃⇧I^ ⇧ I, ⌃⇧I or ⌃⇧I, IntelliJ IDEA displays the following quick information pop-up window:

    lookupListQuickDefView

  • Quick Information View works in a suggestion list. If you select an entry in a list, and press F1, ⌃J, ⌃Button2 Click, F1, ⌃J or ⌃Button2 Click⌃J, ⌃Button2 Click, ⌃J or ⌃Button2 Click⌥Button2 Click, F2, ⌥Button2 Click or F2^ Q, ⌃Q or ⌃Q^ Q, ⌥ Button2 Click, ⌃Q, ⌥Button2 Click, ⌃Q or ⌥Button2 Click, IntelliJ IDEA displays the following quick information pop-up window:

    lookupListQuickDocView

Sorting entries in a suggestion list

To sort entries in a suggestion list:

  • Click a_icon or pi_icon in the lower-right corner of the list to toggle between sorting in alphabetical order, or by relevance.

Please note the following:

  • The sorting icon appears in the list if it is long enough. For few entries only sorting icon is not displayed.
  • Use mouse only to click this icon.
  • IntelliJ IDEA memorizes the type of sorting.
  • Default behavior is defined in the Code Completion page of the Editor settings.

Viewing hierarchy in a completion pop-up

To view hierarchy in a completion pop-up, follow these steps:

  1. Start typing the source code, and press ⌃⇧Space or ⌃⇧Space⌃⇧Space or ⌃⇧Space⌥⇧Space or ⌥⇧Space⇧ ⌥ Space, ⌥⇧Space or ⌥⇧Space^ ⇧ Space, ^ ⌥ Slash, ⌃⇧Space, ⌃⌥/, ⌃⇧Space or ⌃⌥/ or⌃Space or ⌃Space⌃Space or ⌃Space⌃Space or ⌃Space^ Space, ⌃Space or ⌃Space⌥ Slash, ⌥/ or ⌥/. The suggestion list appears.
  2. While in the suggestion list, press⌃H or ⌃H⌃H or ⌃HF4 or F4⌥ H, ⌥H or ⌥H^ H, ⌃H or ⌃H. The Hierarchy tool window shows the type hierarchy of the class, selected in the suggestion list.

    Same way, for the current selection in the suggestion list, you can view call hierarchy (⌃⌥H or ⌃⌥H⌃⌥H or ⌃⌥H⌃⌥H or ⌃⌥H^ ⌥ H, ⌃⌥H or ⌃⌥H^ ⌥ H, ⌃⌥H or ⌃⌥H), or method hierarchy (⇧⌘H or ⇧⌘H⇧⌘H or ⇧⌘H⇧⌘H or ⇧⌘H^ ⇧ H, ⌃⇧H or ⌃⇧H^ ⇧ H, ⌃⇧H or ⌃⇧H).

Closing a suggestion list

Close suggestion lists with or or or Escape, or Escape, Escape, ^ G, ⎋, ⎋, ⌃G, ⎋, ⎋ or ⌃G, then enter your own code at the code completion position.