22 lines
1.1 KiB
Markdown
22 lines
1.1 KiB
Markdown
## Mastering the IDE: Completion
|
|
|
|
In Kotlin, it's easy to explore classes using IntelliJ IDEA, which has *code
|
|
completion*. IDEA attempts to complete what you're typing and show you a list
|
|
of options. After you type the dot, IDEA suggests members which can be called
|
|
on a given element. You can also call completion explicitly by pressing
|
|
<span class="shortcut">&shortcut:CodeCompletion;</span>.
|
|
|
|
Use <span class="shortcut">&shortcut:EditorDown;</span> and
|
|
<span class="shortcut">&shortcut:EditorUp;</span> to select the required member
|
|
and press <span class="shortcut">&shortcut:EditorEnter;</span> to paste it.
|
|
|
|
<span class="shortcut">&shortcut:CodeCompletion;</span> discovers all possible
|
|
operations for a class. You can type the first letters of a member function or
|
|
property to see all the available members starting with these letters, or
|
|
simply containing these letters.
|
|
|
|
Type the identifier name `r` followed by a dot, then press
|
|
<span class="shortcut">&shortcut:CodeCompletion;</span> to see
|
|
the possible completions. Choose `r.sum()` and `s.reversed()` by typing only
|
|
the first letters and using code completion.
|