shavit
shavit

Reputation: 1063

Make Visual Studio's 'Smart Indent' use my coding style

I own Visual Studio 2015 Enterprise and I'm unsure about making VS' Smart Indent feature use my coding style, so far I've configured most of it, except for ternary operators. Example:

bool bSomeBoolean = true;

// my code
for(int i = 1; i <= 39; i++)
{
    Console.WriteLine(bSomeBoolean? "Yes":"No");
}

// smart indent
for(int i = 1; i <= 39; i++)
{
    Console.WriteLine(bSomeBoolean ? "Yes" : "No");
}

VS will add the space before the question mark, also before and after the colon.

How could I stop it from happening? Couldn't find anything in the settings.

Thanks!

Upvotes: 1

Views: 70

Answers (1)

Shweta Goyal
Shweta Goyal

Reputation: 94

Although the smart indent provides beautification to code and improves readability. But if you anyhow don't want this feature, you can turn off the reformatting of code (pretty listing)

In VS2015, you can find this setting at-

Tools > Options > Text Editor > Basic > Advanced > Pretty Listing (uncheck this)

Hope this helps!

Upvotes: 1

Related Questions