How can I disable automatic formatting when pressing enter from within a string literal?
Answered
"Hello"
If I press enter after character e, IntelliJ will produce
"He" +
"llo"
I want it to produce
"He
llo"
How can I do this?
Please sign in to leave a comment.
What is the language in question? SQL has a special setting for that:
https://i.imgur.com/tSCbtuC.png
I'm using Groovy and Java. I did see the feature for SQL. is there any other language support?
This causes a syntax error in Java:
https://i.imgur.com/lOGu1ZM.png
May I know the reason why such functionality is needed? What is your scenario/use-case?
Yes, I would be okay with the syntax error because I intentionally put it there. The problem is one of navigation with the cursor. After arriving at the concatenated string, if I hit backspace it only deletes that opening quotation mark on the new line. It doesn't revert the hot key action. When I type, my muscle memory has me hitting backspace, not cmd-z to undo a keystroke. So at that point I end up holding down backspace until it goes all the way to the previous line and then I'm reformatting the string just to get it to where it was. It's a point of aggravation more than anything. Intellij is trying to help but it causes endless frustration in my workflow. I'm in my 3rd year of a personal license and I still fight with it to undo the action if it was a mistake. I never learned the "correct" way to use this feature and I can't believe cmd-z is the right way.
Ctrl+Z is the only option to cancel concatenation.
Feel free to submit a feature request to add the option to cancel contention on backspace, or disable the smart key:
https://youtrack.jetbrains.com/issues/IDEA