Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using IntelliJ IDE to autocomplete line and place semi-colon

Tags:

In eclipse you can hit "enter" and the IDE will automatically take you to the end of the line and place a semicolon.

In IntelliJ, if you hit shift-enter you get similar behavior minus adding the semicolon. I have read and tried cntrl-shift-enter and you get the exact same behavior. However, that is such an awkward key combination to be using all the time, at least much more so than the one-button approach using Eclipse.

Any ideas?

IntelliJ autocomplete escape

like image 749
sherrellbc Avatar asked Jun 10 '13 03:06

sherrellbc


People also ask

How do I autocomplete in IntelliJ?

Invoke type-matching completion 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 feature in IntelliJ and even in other IDE that allows the program to provide suggestions in completing a statement in Java?

Intelligent code completion IntelliJ IDEA provides context-sensitive code completion, offering you suggestions that are only valid for the current caret position.


2 Answers

In InteiJ IDEA use (Ctrl-Shift-Enter) for "Smart Autocomplete".

It will end the line "smartly" with a semicolon as you wish. It also works in a few different situations like IF statements of FOR loops.

like image 156
voddan Avatar answered Sep 21 '22 09:09

voddan


Why don't you redo the key binding?

Go to: (spanner icon) Settings -> Keymap -> Complete Current Statement and rebind how you will (for example, ctrl-enter might suit you better).

Or there's also a default keymap set for Eclipse that you can choose. I'm not sure if it affects the complete-current-line action, but you could take a look.

like image 28
vikingsteve Avatar answered Sep 18 '22 09:09

vikingsteve