35

Is there a way to avoid closing the following parentheses:

String.Format(), or Console.WriteLine() automatically?

Sometimes is this is annoying and unnecessary, and I end up pressing Delete to remove it.

I tried disabling Auto-insert pair brackets, pharentheses and quotes and Auto-insert closing brace and it is still not working...

Oscar Mederos
  • 29,016
  • 22
  • 84
  • 124
  • 1
    I felt annoying at the start but now I am so used to the auto close that I never end up using the close braces! – Vinod R Mar 05 '11 at 03:34
  • @Vinod R In fact, I enjoy it, but sometimes it just crashes the code (in more than one scenario) – Oscar Mederos Mar 05 '11 at 03:38
  • 1
    I'm surprised it's not working for you. I just tried it here. Can you elaborate on precisely what you do? (Also, 5.1 has been out for some time -- perhaps you're experiencing a bug that has since been fixed? Current version is 5.1.3) – Kirk Woll Mar 05 '11 at 03:43
  • @Kirk I'm not sure about what I need to elaborate. I turned off those two features, restarted VS and the same parentheses are still being closed. I will take a look at the changelogs at JetBrains site... – Oscar Mederos Mar 05 '11 at 03:52

2 Answers2

45

The following options should be unchecked/checked in Resharper if you do not want autocomplete feature on parenthesis (all options can be accessed through Visual Studio > ReSharper > Options... > Environment)

To disable parenthesis auto insert in non method calls (as pointed out in the question, you have already disabled it)

  • Editor > Auto-insert pair brackets, pharentheses and quotes (unchecked)
  • Editor > Auto-insert closing brace (unchecked)

To disable parenthesis auto insert in method calls

  • Intellisense > Completion Behavior > Automatically insert parenthesis after completion > Opening only (enabled)

    Automatically insert parenthesis after completion

Tested in Visual Studio 2008 with ReSharper 6.0.

Community
  • 1
  • 1
Devendra D. Chavan
  • 8,871
  • 4
  • 31
  • 35
  • 1
    This does not work for when i type "new InvalidOperationException" it auto completes with opening and closing parenthesis. Your answer only fixes it for methods not for class constructors or attributes. – JDPeckham Mar 18 '12 at 16:44
  • @JDPeckham, I have checked the second option in VS2010 + Resharper 6. Works as expected for class constructor calls i.e. inserts the opening braces only. – Devendra D. Chavan Mar 18 '12 at 18:08
  • Seems to be a bug with opening only. When I able this option, it still adds the closing. I had to disable it completely. – KingOfHypocrites Feb 27 '14 at 16:13
  • Worth noting that once you've stopped R# doing it, you'll then need to stop Studio itself doing it as per https://stackoverflow.com/questions/11055800/how-to-turn-off-brackets-quotes-auto-completion-in-visual-studio – Jamie Gould Dec 23 '19 at 13:03
4

In Resharper 9.2, I had the same items unchecked as given in Devendra's answer, but still experienced lag when typing parentheses and brackets.

I found that these issues went away by setting Do not complete on values as found in Resharper >> Options > Environment > IntelliSense > Completing Characters. In the Dialog pane that appears, I set the Do not complete on field to (){}. for C# and JavaScript.

meklarian
  • 6,595
  • 1
  • 23
  • 49