Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ autocomplete escape

I'm trying out IntelliJ and have one minor annoyance that I can't figure out if there is a possible solution for in IntelliJ. In Eclipse and even TextMate (as well as many other editors with autocomplete), if you are in the middle of an autocomplete section such as a string or parenthesis area, you can hit Enter or Tab to get to the end of that section. For instance:

if (blah.equals(something.toString()))

The caret would be in the middle of the parenthesis of the toString part. In IntelliJ, you can type through those parenthesis with no issue, or you could maybe hit the "End" key to get to the end of it. One is a minor annoyance, the other is more annoying since I have to take my hands off of the home row. In eclipse I could hit the Enter key and it would get me out of this... TextMate, Tab.

Is there a setting I can tweak or something I can do to give me similar functionality in IntelliJ?

like image 679
intargc Avatar asked Oct 27 '09 15:10

intargc


1 Answers

In that context if you press Ctrl-Shift-Enter as CrazyCoder suggests, you kind of get this behavior. It will add the braces and put your cursor on the next line. You can also press Shift-Enter which will put you to the next line and makes less assumptions about the code. Ctrl-Shift-Enter behaves differently depending on the code it is looking at, so that won't give you consistent behavior. For example in the middle of a string it puts you at the end of the line and adds a semi-colon.

It just seems that end is preferred key here to get to the end of the line. You can add in the key map an additional key to go to the end of the line, if a different key combination works better for you, but it won't just change its behavior because you are in the middle of a parentheses.

Looking at the IDEA options, it seems that the parentheses behavior isn't really a live template like automatically creating a for loop, so you don't tab out when you are done, rather it is just automatically complete the parentheses for you, and intelligently recognizing that you may want to type fluidly as if it didn't.

like image 162
Yishai Avatar answered Sep 28 '22 11:09

Yishai