0

Whenever I do "Ctrl + k + d" the method "()" gets separated by space with its method name like this var x = MyMethod_();

The underscore shows the space.

Ronald Abellano
  • 774
  • 10
  • 34
  • 2
    Are you using an editorconfig file? Or maybe some other custom setting in the options dialog? – Wouter de Kort Aug 18 '21 at 07:47
  • [Options dialog box: Text Editor > C# > Code Style > Formatting](https://learn.microsoft.com/en-us/visualstudio/ide/reference/options-text-editor-csharp-formatting) • [Code style preferences](https://learn.microsoft.com/visualstudio/ide/code-styles-and-code-cleanup) –  Aug 18 '21 at 07:52
  • 1
    Does this answer your question? [How do you auto format code in Visual Studio?](https://stackoverflow.com/questions/5755942/) and [How to format space between operators C++ Visual Studio?](https://stackoverflow.com/questions/39964033/) and [Can Visual Studio 2017 remove space around = like Vs2010?](https://stackoverflow.com/questions/45653339/) and [Turn off auto formatting in Visual Studio](https://stackoverflow.com/questions/737222/) –  Aug 18 '21 at 07:53

2 Answers2

2

You can edit it when searching for Formatting in the options menu. Then go to Text Editor > C# > Code Style > Formatting > Spacing Scroll down to Set spacing for method calls and disable "Insert spacing between method name and its opening parenthesis".

enter image description here

Joost00719
  • 716
  • 1
  • 5
  • 20
1

You can update the relevant settings here:

Tools > Options > Text Editor > C# > Code Style > Formatting > Spacing > Set other spacing options

Note, your .editorconfig file (if exists) might override the local settings configured on that page which only apply to your machine.

It would be best to configure it in the .editorconfig file which will be common to all engineers who use the repository.

Misha Zaslavsky
  • 8,414
  • 11
  • 70
  • 116