views:

262

answers:

1

Situation

I have a plain text file where indentation is important.

line 1
  line 1.1 (indented two spaces)
  line 1.2 (indented two spaces)
    line 1.2.3 (indented four spaces)

In Visual Studio 2008, when I pressed enter, the next line would also be indented four spaces.

However, in Visual Studio 2010, when I press enter, the next line is indented one tab.

Question

Does anybody know where, in the mountain of preferences under Tools > Options, I can return to the way that Visual Studio 2008 worked?

Under Options > Text Editor > Plain Text > Tabs, I see the following:

Options Dialog

If I select "None", then I get no indentation when I move to the next line. If I select "Block", then I get TAB indentation (even though the previous line is spaces).

In Visual Studio 2008, my indentation is set to "Block", and I get spaces.

I have no idea what "Smart" indenting is, or why it is disabled.

+1  A: 

"Smart" indenting is essentially asking the language service to do indentation, which covers cases like adding an extra indent level after an { in C# files. Since plain text files don't have a language service, it isn't available here. If it was, the behavior (matching indentation from the line above) would be whatever the language decides to do, though I'm pretty certain it respects the "Insert spaces"/"Keeps tabs" option.

"Block" indenting is asking the editor to take care of it, which it takes to mean "maintain the same indent level as the previous line". It appears that, in VS2008, it copied the indentation from the previous line, whereas VS2010 respects the "Insert spaces"/"Keep tabs" setting.

Can you file a bug on Connect about it? I'm not sure if it was changed on purpose or not, so it will help for this to go to our (the editor team's) triage people to make sure.

Noah Richards