
Typing {} is no longer a coding issue on IntelliJ
You know, typing curly braces {} is a headache for developers … No weak pinky finger, no awkward position, no Shift key. Here are two lifesavers on IntelliJ
Typing code without braces is impossible (You know, we use them for method signature and statements such as if, for, while) But typing them is so hard and overwhelming and it affects your pace negatively.
- Use ALT + Insert
Let’s say you want to create a new method. You can use Generate a constructor for this and it will be created instantly. You know, the constructor’s signature is almost similar to the method’s. So all that remains is to type the method name and return type, which is much more exciting than opening and closing parentheses and braces.
2. ConfigureCode Style-Java-Wrapping And Braces settings
“Force Braces” option is set to “Do not force” as default on IntelliJ. If you set this option to “When multiline” or “Always” for statements, you don’t care about braces any longer. Just keep typing your codes.
Let’s say you want to add an “if” statement in your code. First, you type an “if” and press ENTER. IntelliJ will complete your code with “()” and the cursor will be over there, no need to change the mouse’s position. Once you declare your statement. Don’t deal with an opening brace, just enter a new line. Once you type a new line and press ENTER, braces will be automatically surrounded by your new line and the cursor will be just over there to move on to typing the next line …