Is there a way to lock or freeze a part of code against formatting in Visual Studio?
I want to protect the following code :
Method("This is a long text", 12 , true );
Method("Hi", 558, true );
Method("Short text", 1 , false );
to be formatted as:
Method("This is a long text", 12, true);
Method("Hi", 558, true);
Method("Short text", 1, false);
but still be able to format the rest of the document.
You can turn it off completely (
Options->TextEditor->Basic->General) uncheck off Pretty Listing. And underOptions->Text Editor->C#->Formattingturning off options there.But, sadly, there isn’t any built-in option to selectively prevent formatting a portion of code.