Основной целью IntelliJ IDEA является продуктивность разработчика, и для этого она предоставляет мощные возможности автоматического дополнения codeа. Однако, так How есть несколько функций дополнения codeа, важно разобраться How они работают и Howую когда лучше использовать.
Simple Complement Simple Complement makes the most primitive guesses for variable names, types, methods, expressions, etc. It's worth mentioning that the simple add-on automatically works as you type. This means you don't have to press any keyboard shortcuts to see the list of suggested options. But if you still want to call it manually, you can press Ctrl + Spacebar .
Note that if you call the simple addition twice, it will show you more options, including private members.
Smart Add-on In addition to the simple add-on, IntelliJ IDEA provides Smart Add-on, which is much more advanced and comprehensive. A smart add-on understands what type is expected and how data types are converted, and offers options appropriate to the context. To launch Smart Add-on, press Shift + Ctrl + Spacebar . Note that if you run Smart Addition twice, it will show you more results, including chains and non-imported static members.
Tab Key Completion If you select an item from a list of suggested options by pressing Tab , it will overwrite the identifier where the cursor is located, instead of just appending that option. This is useful if you are editing part of the identifier, such as the file name.
Statement Completion Statement completion automatically adds missing parentheses and required formatting. To complete a statement, simply press Shift + Ctrl + Enter (Shift + Cmd + Enter for Mac) .
Complement Inversion If you select a Boolean element from the list of suggestions by pressing ! , then IntelliJ IDEA will automatically add the inversion operator to the result.
Median Match IntelliJ IDEA also supports something called Median Match. This means that you don't have to write the ID from the very beginning. For example, if you only remember part of a name, write it and IntelliJ IDEA will still find the correct one for you.
Parameter Information If you need to see the inferred parameters for a method or constructor, simply press Ctrl + P (Cmd + P for Mac) . IntelliJ IDEA will show parameter information for each overloaded method or constructor, and highlight in color the closest match for the parameters you have already entered. This will help you choose among overloaded options and compare your input with what is expected.
Quick Pop-ups There are several options for pop-ups - with documentation (by Ctrl + Q or Ctrl + J on Mac) or definition (by Shift + Ctrl + I, or Shift + Cmd + I on Mac) available when you look at the list of options code additions.
Remove from Add-on If you are fed up with a certain class constantly appearing in the add-on list, IntelliJ IDEA can remove that class or the entire package and you will never see it again. Simply press Alt + Enter on this item and confirm removal from the list. You can turn it back on in Settings → Editor → Auto Import .
Add-on Settings If you want to change the default settings for code completion, you can do so in Settings → Editor → Code Completion .
GO TO FULL VERSION