IntelliJ autocomplete escape

后端 未结 4 1276
北恋
北恋 2021-02-20 07:37

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 ot

4条回答
  •  鱼传尺愫
    2021-02-20 08:20

    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.

提交回复
热议问题