How to make a "Complete Statement" with "if" to always add curly brackets and a new line?

Right now, when I'm writing an if and press CTRL+SHIFT+ENTER for Complete Statement, it will move to the next line, idented. If I add another statement and then press ENTER, the cursor exits the if. But my intention by doing a Complete Statement in the if was to open an if block and stay in it.

It only works if I perform a Complete Statement again, in another command inside the if:

How to make it ALWAYS add curly brackets when I perform Complete Statement inside the if declaration?

2 comments
Comment actions Permalink

Another undesired result: I wanted to Complete a Statement on the function call - and it worked. But it also put me outside of the if. It would not happen if the complete statement in the if added curly brackets:

0
Comment actions Permalink

Hi,

As far as I can see, all the gifs show expected behaviour. In case when you do not use curly brackets, the second statement will not be a part of if clause.

To complete if statement with brace you use `Complete statement` action that has a shortcut in your case CTRL+SHIFT+ENTER. Pressing Enter does not completes the current statement.

Please find more info about this action on https://www.jetbrains.com/help/rider/Coding_Assistance__Complete_Statement.html.

 

Hope this can help.

K.R.

Sofia

0

Please sign in to leave a comment.