Search code examples
c#visual-studiovertical-alignmentcode-formattingautoformatting

Vertical code alignment VS Visual Studio 2015 autoformatting


I use codealignment extension for Visual Studio 2015 to align C# code vertically, so the formatted code looks like this:

PortfolioId   = model.PortfolioId,
ItemId        = model.ItemId,
Name          = model.Name,
PurchaseDate  = model.PurchaseDate,
PurchasePrice = model.PurchasePrice,

Also, I like to auto-format code in the whole file using Ctrl+K+D shortcut, so all vertical alignments are broken in result.

Is there any way to configure auto-formatting to left vertical alignments unchanged?


Solution

  • I finally found a solution. In Visual Studio options there's a Formatting - Spacing - "Ignore spaces in declaration statements" checkbox.

    Ignore spaces in declaration statements