1. Basic completion
Basic completion offers most trivial suggestions for variables, types, methods, expressions, etc. It is worth mentioning that IntellIJ IDEA provides Basic completion automatically when you start typing. This means you don’t need to press any shortcuts to see suggestions. But if you want to call it explicitly, simply pressCtrl+Spaceshortcut.
Note, when you call Basic completion twice, it shows you more results, including private members.
2. Smart completion
Additionally to Basic completion, IntelliJ IDEA provides Smart completion which is much more advanced and comprehensive. Smart completion is aware of the expected type and data flow and offers the option relevant to the context. To call Smart completion, pressShift+Ctrl+Space.
Note that when you call Smart completion twice, it shows you more results, including chains and non-imported static members.
3. Completion with Tab
If you select an item from the suggestion list by clickingTab, it will overwrite the identifier at the caret, instead of just inserting the suggestion. This is helpful if you’re editing a part of an identifier, such as a file name.
4. Statement completion
Statement completion automatically adds missing parentheses, brackets, braces and adds the necessary formatting. To complete a statement, just pressShift+Ctrl+Enter(Shift+Cmd+Enterfor Mac).
5. Negating completion
If you select a boolean item from the suggestion list with!, IntelliJ IDEA automatically adds the negation operator to the result.
6. Middle matching
IntelliJ IDEA also supports so-called Middle matching. It means that you don’t necessarily need to type an identifier from the beginning. For example, if you only remember a part of the name, just type it and IntelliJ IDEA will still find the right matches for you.
7. Parameter info
If you want to see the suggested parameters for any method or constructor, just pressCtrl+P(Cmd+Pfor Mac). IntelliJ IDEA shows parameter info for every overloaded method or constructor, and highlights the best match for the parameters already typed. This helps you to choose between overloaded options and compare your input with what’s expected.
8. Quick popups
Quick popups such as Quick documentation (viaCtrl+Q, orCtrl+Jfor Mac) or Quick definition (viaShift+Ctrl+I, orShift+Cmd+Ifor Mac) are available when you browse suggestions in code completion.
9. Exclude from completion
If you are fed up with some class constantly appearing in the suggestion list, IntelliJ IDEA can exclude this class or even a whole package so you never see it again. Just pressAlt+Enteron an item and confirm the exclusion. You can always turn it back inSettings→Editor→Auto Import.
10. Completion settings
If you want to change the default settings for completion you can do it viaSettings→Editor→Code Completion.
2 Comments
Anonymous
Is there a cheat sheet available for these and other such key combo codes. This would be a convenient quick reference for beginners, etc...
Dmitry Jemerov
Yes, of course. Use Help | Default Keymap Reference in IntelliJ IDEA to access it.