I did a little searching here and I am surprised that no one has asked this question. Is Visual Studio 2010's VB smart indenting just horribly broken for multi-line statements? Or am I doing/setting something incorrectly? I have it set to 4-character indents with keep tabs. Typing a multi-line statement in VB with natural returns yields the following (property names changed to protect the innocent).
Public Sub Sub1()
Dim foo As New MyClassA With {.FileName = "test",
.Format = MyEnumForImageFormat.jpg,
.IsReallySpecial = False,
.Name = "testN",
.SourceId = Guid.NewGuid(),
.VariantName = "TestV",
.Width = 800,
.Height = 600}
End Sub
How could anyone want to format their code this way? I thought, maybe I need to reformat (Ctrl+K Ctrl+D):
Public Sub Sub1()
Dim foo As New ImageBase With {.FileName = "test",
.Format = MyEnumForImageFormat.jpg,
.IsReallySpecial = False,
.Name = "testN",
.SourceId = Guid.NewGuid(),
.VariantName = "TestV",
.Width = 800,
.Height = 600}
End Sub
For good measure, I tried Reformat again. Lo and behold, it pushed it further left. I pushed it again, and it moved some more. Finally, after four reformats, my code looks like:
Public Sub Sub1()
Dim foo As New ImageBase With {.FileName = "test",
.Format = MyEnumForImageFormat.jpg,
.IsReallySpecial = False,
.Name = "testN",
.SourceId = Guid.NewGuid(),
.VariantName = "TestV",
.Width = 800,
.Height = 600}
End Sub
Better, but we really want the continuing lines indented by only a space? And why should I have to reformat four times to get what I want? To top it off, trying to add one more property definition above does not keep anything aligned--the default indent is to cascade offset to the right by a randomly-determined number of space and tab characters.
Using old-style continuation characters doesn't help. How can I have smart indenting with any degree of sanity?