Smarter indentation and alignment
There's a difference between indentation and alignment.
Indentation happens at the block level, in the C derivatives (C++, C#, Java, ...), after an opening curly brace.
Alignment happens when one wants to align things on the same column beyond indentation for improved readability, like function params (either call or declaration/definition), getters/setters' names
Unfortunately, when one starts typing aligned things (with tabs on the beginning on the lign for indentation, then spaces for alignment), and types enter for a new line, VS changes all the carefully typed alignment spaces into tabs.
This is annoying because...
1. When someone else opens the code with a different setting for tab size, alignment does not work anymore. This is rare but still.
2. Tabs don't work when realigning. Say when you add a getter with a longer name and you alt-select all the others to add spaces.
The most obvious solution is for VS to keep the alignment characters (tabs and spaces mix) of the current line and use it on the next line when hitting enter.
For me is enough to have different tab logic for indentation and alignment.
When I indent I want to have true tabs stored in file but when I align I want my bats to be converted to spaces.
And one more thing is navigating in text editor must be by tabs, event I have spaces inserted.
So we can fast navigate in text using arrows fast indent and align code and everything well be ok for mosly any programmer and for any codestyle.
Neil Z. SHAO commented
For another thing related to smart indentation, I got this weird thing in vs2013. When I type in this:
............int a = 0;
It's super weird that vs2013 cannot deal with these omitted brackets. It format my code like this:
....int a = 0;
The 'int a = 0;' has incorrect indentation, which is unacceptable. And this doesn't happen in vs2010 or vs2012. Please fix it!
Michael Wild commented
What's worst for me is that the automatic alignment support (e.g. for wrapped function parameter lists, XML tags etc.) uses as many tabs as possible (at the current tabsize setting) and then fills the rest with space. If I prefer tabs which are 2 spaces wide, my co-worker wants them to be 4 spaces wide things start to fall apart an look really messy. Instead, the automatic alignment should be done using tabs up to the current indent level, and then be filled up with spaces. It's not THAT hard to do, even the oh-so-outmoded Emacs and ViM do it.
Dan Neely commented
Visual studio readily deletes excess space when adding/removing a } triggers autoformat, so just letting mixed tabs/spaces won't help much. What we need is for the auto-formatter to detect when a block of function calls have had extra spaces inserted to align their parameters and to leave them alone as a result.