Java Reference
In-Depth Information
Figure 3.13 Because a field or a method reference can follow
a dot, invoking code completion in that context lists all
accessible method invocations and all accessible fields.
prefix get . This is an excellent way to narrow down the list of options or browse
the list of available properties of a class.
When you press Enter or double-click the mouse to accept a completion
from the suggestion list, the completion is inserted to the left of the car-
et, preserving the source text; think of this as insert mode. If you press
the Tab key, however, the selected completion is used to replace the
symbol at the caret with the selected suggestion; think of this as replace-
ment mode.
TIP
Similarly, if you invoke basic code completion directly after an object dot separa-
tor, all of that object's accessible methods and fields appear in the suggestion list.
An example of this behavior can be seen in figure 3.13.
You can use the Quick JavaDoc command ( Ctrl+Q ) to view the JavaDoc
for the currently selected completion.
TIP
Using basic code completion to create variable names
When you invoke basic code completion as part of a field, parameter, or variable
declaration, IDEA suggests a name for your new reference, using the item's type
to generate a list of suggested names. An example is shown in figure 3.14; here,
we're creating a new local variable of type FixedRateCurrencyExchangeService .
Figure 3.14 Code completion can also be used to suggest a
variable name when you're creating a new variable.
 
 
 
 
Search WWH ::




Custom Search