SamIAm
SamIAm

Reputation: 2489

Why is Resharper adding an extra } when I create a property?

I have just installed the resharper extension on my Visual Studio and when I type the following:

public string value {get; set;}

Resharper adds the braces around get;set; and highlights the last }. Then when I type }, it adds another } in the line below it?

Why is this happening?

Upvotes: 1

Views: 41

Answers (2)

Bryan - S
Bryan - S

Reputation: 99

I know this is a pretty old topic, but I just ran across this myself after reinstalling reshaper 10 for VS2015 - it's maddening...I cant believe this bug has been around this long.

To correct it: Remove the checkbox next to "Auto Format on Closing Brace" - this will allow overtyping on the ending brace in properties without adding the additional brace.

Options Dialog for Resharper

Upvotes: 1

Igal Tabachnik
Igal Tabachnik

Reputation: 31548

This might not be ReSharper, but actually Visual Studio. Since 2013, Visual Studio supports automatic brace completion, but it doesn't play well with that of ReSharper (which is preferable, since it supports overtyping - typing another } will replace an existing }).

Best thing you can do is to turn off Visual Studio's automatic brace completion, by going to Tools - Options - Text Editor - C# and unchecking "Automatic brace completion":

EDIT: I just noticed you tagged this as visual-studio-2012, which doesn't support this out of the box. Do you have the Productivity Power Tools extension installed as well?

Upvotes: 0

Related Questions