Noob question on auto-reformatting

Forgive me, as I am new and a little overwhelmed by the multitude of configuration options. I've tried to tweak the options to do what I want, but it doesn't, and I'm stumped. I must be missing something.

I want my if statements to have whitespace within the parens, like so:

if ( foo == true ) {

}

However, as I type and close the paren and ending brace, my code does not get auto-formatted, and remains like so:


if (foo==true) {

}

It's driving me nuts. I'm sure this is a common and over-asked question, my apologies again, and I'd really appreciate a little help on this one ?:|

5 comments
Comment actions Permalink

Hello Darryl
     Have you tried turning on 'If parentheses' option under ReSharper | Options | Code Editing | C# | Formatting Style | Spaces | Within Parentheses? Let me know if this helps. Thank you!

Andrey Serebryansky

Senior Support Engineer

JetBrains, Inc

http://www.jetbrains.com

"Develop with pleasure!"

0
Comment actions Permalink

Hi Andrey, thanks for the reply. I do have that setting checked, I'm afraid.

There are so many settings and hopefully I'm just missing something. I am attaching an export of my settings so that hopefully it'll be easier to determine what I'm doing wrong.



Attachment(s):
resharper export.DotSettings.zip
0
Comment actions Permalink

Hello Darryl
     Do you get the spaces inserted if you manually run Code Cleanup (ReSharper | Tools | Cleanup Code) on this file? Thank you!

Andrey Serebryansky

Senior Support Engineer

JetBrains, Inc

http://www.jetbrains.com

"Develop with pleasure!"

0
Comment actions Permalink

Hi Andrey, yes, doing that does reformat the statement as I was expecting it to happen on-the-fly.

0
Comment actions Permalink

I was finally able to figure it out. In the options under Editor, I had Auto-insert closing brace checked. When I unchecked this, the auto formatting worked correctly when I typed the closing brace myself, instead of having it entered by Resharper. Looking back, I see I was a little unclear about this in my original post, and implied that I was typing the closing brace. Sorry for the confusion, but this does seem to be a bug: whether the user or Resharper is providing the closing brace, the auto-format should occur.

Update: I created the following bug report: http://youtrack.jetbrains.com/issue/RSRP-324842

0

Please sign in to leave a comment.