Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ autocomplete to replace the function name

I've switched from Eclipse to IntelliJ and there is something which I couldn't find yet nor google:

How to get the autocomplete to replace the name of the function? In Eclipse, it would be the ctrl+enter functionality.

For example,

userController.setAmount(); 

suppose I would like not to call the setAmount() but a setDefaultPassword(), I place my caret after the set then ctrl+space to autocomplete, the setDefaultPassword() shows up but if I press enter, it won't replace Amount() and I'll end up with

userController.setDefaultPassword();Amount(); 

So obviously what I wanted is to replace the setAmount() by setDefaultPassword().

like image 992
Qualaelay Avatar asked Jun 04 '15 09:06

Qualaelay


People also ask

How do I autocomplete in IntelliJ?

Start typing. By default, IntelliJ IDEA displays the code completion popup automatically as you type. If automatic completion is disabled, press Ctrl+Shift+Space or choose Code | Code Completion | Type-Matching from the main menu. If necessary, press Ctrl+Shift+Space once again.

What is code completion in IDE?

Intelligent code completion is a context-aware code completion feature in some programming environments that speeds up the process of coding applications by reducing typos and other common mistakes.

How do you find occurrences in IntelliJ?

From the main menu, select Edit | Find | Find in Files Ctrl+Shift+F . In the search field, type your search string. Alternatively, in the editor, highlight the string you want to find and press Ctrl+Shift+F . IntelliJ IDEA places the highlighted string into the search field.


1 Answers

Press Tab instead of Enter to select the item, and the identifier will be replaced. See also http://jetbrains.dzone.com/articles/top-20-code-completions-in-intellij-idea

like image 103
Peter Gromov Avatar answered Nov 07 '22 06:11

Peter Gromov