0
votes

The code base I am working with uses a KNR formatting like this.

void foo(bool bar) {
    if (bar) {
       // do something
    } else {
       // do something else
    }
}

I am generally not a fan of this formatting and would much prefer the following.

void foo(bool bar)
{
     if (bar)
     {
         // do something
     }
     else
     {
         // do something else
     }
}

The owners of the code base use Visual Studio 2019 and when doing Edit.FormatDocument(Ctrl+K+D), it will auto format to the first code block.
I was wondering if there's a method in VS I could switch to my preferred format when I'm opening a file to read/code(doesn't have to be automatically), and return back using (Ctrl+K+D) when I'm submitting?