Visual Studio 2010 Forces Tab Indenting
An anonymous reader writes "For years, Microsoft has allowed Visual Studio users to define arbitrary tab widths, often to the dismay of those viewing the resultant code in other editors. With VS 2010, it appears that they have taken the next step of forcing tab width to be the same as the indent size in code. Two-space tabs anyone?"
This tab thing makes Slashdot front page and the following didnt? Windows 7 way hotter than Vista off the line, now more popular than all OS X versions. Okay then...
How is this tab things news or interesting at all? Here is what Brittany Behrens a PM for the editor team said:
(bolding above mine for emphasis)
Gee, the team solicited comments, did some research and made a change that people wanted. Of course, any change will make somebody unhappy.
Brittany even volunteered to give folks a simple editor extension to make the settings different for those that want it. My assumption is that anyone using Visual Studio is a developer and capeable of using such an extension, or writing it themselves. It is not difficult.
-Foredecker
Jibe!
Visual Python anyone? Doesn't Python force tabbed spacing for scoping?
It seems to me that most editors jump to the current indent level when you press tab - or if not, they should. I can't imagine many people want tabs to really go eight spaces...
But this is why rather than using tab characters in code I've always felt editors should backfill with spaces instead of tabs (outside of editing makefiles of course!)
"There is more worth loving than we have strength to love." - Brian Jay Stanley
FIGHT!
It's things like this that convinced me using spaces is the only way to fly. You also need an editor that knows how to indent to the right place by inserting the right number of spaces (i.e. not vi out of the box or notepad). Anything else will always get screwed up by someone or some tool.
One of the first things I've always done when setting up Visual Studio on a new computer is to set the option to insert spaces instead of tab characters. I find tab characters, to put it bluntly, irritating and utterly unnecessary. (You can imagine my opinion on standard makefile syntax!)
So, for all those tab fans, what is it about tabs that you find useful?
It's an example of Microsoft imposing a policy decision on users of the software. Some of them don't want this, but they're going to be forced to do it this way because Microsoft is defining a tab policy
The problem with this is.... old code, created with different settings in VS 2008 or earlier.
And the need to be able to open it in VS 2010 and actually make sense out of it.
E.g. backwards compatibility.
Also, configurability of tab width and indent width is probably a good thing.
If the other editors can't config tab width, they suck.
Obviously companies and developers using the software should have coding standards that specify what tab width and indent width to use (normally 4 spaces)
But still, regardless of software used, the number of spaces to use for a tab is a policy thing, that should be dictated by the developer(s) or their company.
Ending sentence fragments with anyone, anyone? Does anyone like this convention, anyone? Can we just see it die horribly in flames, anyone?
Comment of the year
Tabs are news?
Have you no sense of responsibility to your audience?
Herb Sutter once observed in relation to C++0x that when it comes to complex, interesting questions of language design, very few people are even vaguely qualified to comment, and when it comes to issues of whitespace every idiot on the planet has an opinion. And when those idiots get the chance, they'll post those issues as news on an aggregator of some sort (ok, that last part wasn't Herb Sutter).
Nice. I'm sure you'ld prefer to have something closer to the Windows core than this, but nice first post. If you're going to advocate it pays to have front billing.
Now if you're going to drive off course from source code formatting to operating system adoption I can be forgiven for also going wide afield.
How's that Window Mobile thing working out for you? Have they canned Roz Ho yet for the Danger debacle? Will she have to extrapeneur to a startup and bring back its corpse to prove her loyalty, or will she choose to spend more time with her family? Is September a solid date for WinMo7, and even then how do you expect phone vendors to personalize their experience and ship product for Christmas?
Frankly I think two team reboots in the last year means you've got nuthin' for Christmas '10, and Christmas '11 is looking like less than even money. That's a long time for iSlates and Android tablets to be walking all over you. Of course I've got it being any good at 30:1 against.
And what about Ballmer? Is an off 40% decade while Apple grew 7x and Google grew 4x not enough evidence that he's not getting it done? You would figure with all of the leverage and cash he's got he could do better if he was any good. Hell, I think I could do better than that even if I gave half the gross profits away to get some global love. With the money Ballmer has wasted on obvious dead ends over the last decade we could buy each Haitian refugee his own quake-proof palace.
Help stamp out iliturcy.
For years, Microsoft has allowed Visual Studio users to define arbitrary tab widths, often to the dismay of those viewing the resultant code in other editors.
There are editors that don't let you define arbitrary tab widths? No, seriously -- I'm not sure I've ever seen an editor that didn't provide the option, generally along with the option to have the tab key insert spaces instead of tabs, thereby avoiding that issue and the inevitable problems that arise as tabs and spaces are mixed.
And if that doesn't work, there's this really newfangled tool called indent that you can use...
Proud member of the Weirdo-American community.
Do they count all of us who bought computers with Windows 7 pre-installed and then deleted it? Sure people rushed to Windows 7 - it's been a while since anyone running a PC could buy it with an OS that wasn't total crap so they could all finally get the updates they wanted. Windows PCs tend to be cheaper than Macs. Saying they outsell Macs is like saying they sell more Ford Focus's than BMW's. A PC does what a Mac does for half the price. It just doesn't look as good, work quite as well, last as long, or offer the same smug bragging rights. And of course you can get a juiced up PC just like same people will take a Ford Focus and soup it up. Why I dunno but I guess some people enjoy the challenge or are just smoking to much crack.
At what price learning? At what cost wisdom? The price is a man's peace of mind, and the cost is his life.
Or you can intent with a single space and your code will be clear and easy to read instead of quickly rolling off the end of my 30" monitor. I should never have to scroll horizontally when reading code. Of course some dipshits think the entire program should be on one line. Who uses a crappy editor that doesn't adjust formatting to match your preferences? The tab character has the semantic meaning of jumping to a random spot in the middle of the page with the behavior being different in every app on every computer. It's best left for meaningless tasks like switching between windows.
At what price learning? At what cost wisdom? The price is a man's peace of mind, and the cost is his life.
If the VC IDE was as "smart" as any that I use it would just write a comment in the file containing the indent and tab settings, use default settings if the special comment doesn't exist, and allow the user to override / adjust those settings.
e.g.
/* MS_VC_INTENT=2; MS_VC_TAB=4 */
It's the old "Use Comments for Meta-Data" trick (As seen everywhere else...)
<!DOCTYPE> anyone?
The point is that they didn't want to fix their own bugs related to the setting so they eliminated the cause...
They got rid of the setting and claimed "It's not a bug, it's a feature!"
Plain and simple. If they standardized tabs with a quantity of space chars in all their editors then it is very, very good news. That's the only way to have consistency across all viewers/editors.
in cross-platform project is to force everyone to use spaces only. ;-)
The shit that happens to code with tabs that get edited on unix and windows and different editors make the text to travel towards the right side of screen at exponentially increasing speeds.
Add some retarded editors and direct copying of sources between unix and windows without going through source control system that converts line endings and you will also have empty lines being added as well.
The end result is 1/100 ratio between code and whitespace.
Hello from the trenches
Standardized tabs was great back in the old "10: if ( x ) goto 100" days...
But today 8 spaces per tab is far too much for most folks.
Nearly all newer code has portions that are deeply nested.
if ( x ) {
x.addEventListener (
"hover",
function() {
window.status = "Hovering Over X";
x.changeColor (
{
text: "green",
background: "black",
outline: "white"
}
);
},
true
);
}
This is a mild example of 5 levels of nesting.
Some code is more deeply nested than others, and some fonts are wider than others.
Changing the tab spacing let's us see more without having to scroll horizontally decrease our font size.
Here's the same code with 1/2 the tab width.
if ( x ) {
x.addEventListener (
"hover",
function() {
window.status = "Hovering Over X";
x.changeColor (
{
text: "green",
background: "black",
outline: "white"
}
);
},
true
);
}
What looks fine on my screen may look very different on someone else's.
Using tabs and editors that allow tab size adjustment allows coders to manage the source code more efficiently.
Honestly, where is the editor that has at least as much functionality aimed at a developer as a word processor? I'm not saying the SAME functionality, but an equal amount of functionality.
As for the same functionality, starting with a spell checker for comments (in the very least) would be kinda nice.
Yes, yes. Let's all forget about those nasty invisible characters like \r \n and especially \0
\r and \n are quite visible, considering you see another line when an editor encounters them... and generally displays something if it does not understand what they are.
"There is more worth loving than we have strength to love." - Brian Jay Stanley
Comment removed based on user account deletion
I know this is Slashdot an' all but really? You've got to the point where you have to bitch about tabs settings in MS's development environment. Have MS not been squishing enough small companies or something equally evvvvvvil for you lately? Quick everyone, another example of MS being a horrible overlord, they've combined tabs and indent in Visual Studio!
*sigh*
And then comes another guy who uses three spaces to indent and your code is gone. Allowing each user to change arbitrarily the width of the TAB is a BAD idea.
The original use of the TAB key was to ease the creation of tables in typewriters. There was a set of mechanical stops, one for each column, and you could set or reset each stop. Pressing the TAB key moved the carriage to the next stop. Some electronic terminals, like the VT-100 for instance, kept this convention, allowing one to set or reset the TAB stop for each column. In modern computers this is not really necessary, since editing tables is often done in spreadsheets.
Setting the TAB width arbitrarily at fixed multiples of eight or any other number of columns really doesn't help much, since the indentation support of modern editors is much more powerful than that.
The only use of the TAB key for me is moving to the next widget in the GUI.
This!
(USER WAS PUT ON PROBATION FOR THIS POST)
Comment removed based on user account deletion
Probably more people than you'd think. It serves my professional and hobby needs extremely well, personally. I wasn't a big fan before the 2008 version, but I'm quite happy now.
Gee, how difficult is it to provide a 3rd option?
The energy spent for this is many million times more than the energy that would be spent by a programmer to put another check box there and synchronize the two options.
Do they count all of us who bought computers with Windows 7 pre-installed and then deleted it?
Does the geek count the beta testers who drove Win 7 past Linux no later than August of last year?
Does he count all the close-out deals on the Vista PC that qualified for the free upgrade to Win 7?
Net Applications publishes web-based stats.
Real users accessing real sites.
Heavily trafficked sites like Amazon, ESPN, Google - and Mozilla.
You don't boot into another OS to access the headline news from Fox.
Frankly, I think that plain text is a terrible format for source code. It unites content and presentation instead of separating them. I'd much more prefer to use a system similar to HTML/CSS where one file dictates the actual code, and the other part how I want to look at it. This way, I can have a custom CSS that uses tabs and places opening curly brackets on a new line, and my coworker can have a CSS that uses spaces and puts the curly brackets at the end of a line.
Source code formats could furthermore be in a hierarchical XML structure, making loops child nodes of functions which are child nodes of class nodes. This would save all the guesswork and black magic that currently goes into syntax highlighting and code folding.
No more will my SVN logs and diffs be messed up by a supid text editor insisting on changing all line feeds. No longer will there be any discussions about code formatting guidelines.
This is 2010, why are we sill saving code in dumb text files like in 1960?
Isn't the tabs. Its that, despite a howl of protest on the main Microsoft board, they claim to be unable to add an input box and label to a form with a release date still undetermined. How long and how disruptive could this task possibly be when the macro solution someone came up with shows the integration of settings is at the u/i level?
Honestly, I think the guy from visual studio lied.
This is my sig.
It is really unfortunate the IDE's let people change the tab setting and even more unfortunate that IDE's like Eclipse and IntellJ come with it incorrectly set to 4 spaces. This has the effect of totally buggering the code when viewed in any context other than one with the same settings. Printers and most code viewers use an 8 character tab stop.
Yes things work fine if you forbid mixing tabs and spaces in indent but, in my experience this does not work in practice.
The difference between Canada and the USA is that in Canada healthcare is a right and gun ownership is a privilege.
Subject: ASSERTION
Body: NOTHING RELATED TO ASSERTION
You assert Windows 7 sucks but have nothing in your post's body to suggest why you assert this. I would like to know what's so bad about Windows 7 (other than it being a closed-source proprietary operating system).
Because...I hate Microsoft's business practices. I hate the unethical behavior of the company's directors and executives. I hate many of their products because many of their products are de facto industry standards despite being demonstrably garbage. But I'm running Windows 7 Pro x64 now and you know what? I hate that I like it so much. Unlike the vomit-inducing Vista, Win7 does everything I want and feels as good with resources as XP, runs all the Windows specific apps I need without anally raping me with a bottle of WINE, drives multiple monitors without a hitch, has a sensible audio subsystem, a clipboard system that isn't all over the place, and runs VirtualBox with any and every Linux guest OS I need without as much as a hiccup.
Sure, YMMV but IMHO 64-bit Windows 7 is absolutely the best operating system ever to come out of Redmond, WA. Is it perfect? Of course not. There's no such thing as a perfect OS. But I think it's pretty damn good. And this disturbs me.
So please help me hate Windows 7. I feel dirty.
Is that you, Gary Busey?
ON DELETE CASCADE
If you have to follow the GPL and release your code, but don't really want anyone to read it, mix tabs and spaces freely. Don't forget to be inconsistent about the number of spaces you use.
This will make anal programmers' heads explode.
One true tab.
It's not like we don't have large enough monitors to accommodate it.
BTW - I wrote a script to change all the spaces used to indent php code for a popular cms to tabs
s/ {2,8}/\t/g; # replace anything from 2 to 8 spaces with a tab
Also joined long lines that had ridiculous double-indent for the second, 3rd, 4th, 20th lines,
Added a few other optimizations, like removing the stupid "xml-like" closing of entities in html files.
End result - shrunk it from 21 megs to 2.
WTF is wrong with using a hard tab? Hard tabs mean less data to read and write, fewer characters to interpret at runtime, etc. The hard tab is not only good for performance, it's environmentally friendly.
I view tabs not as semantically meaningful, but as a quicker alternative to dealing with multiple spaces. When reworking code, I find it easier to add/delete a single tab than multiple spaces.
And I find it easier still to hit "indent region" in whatever editor I am using to fix all whitespace across multiple lines at ones. There is no need for tabs in any modern editor (or even un-modern ones since plenty of old editors can just as easily re-indent code) because you are treating all whitespace blocks the same.
"There is more worth loving than we have strength to love." - Brian Jay Stanley
Our historical coding standards have been indent 4 and tab 8 for over 25 years and the code is in an archive system that allows the checking of differences between any two commits. Changing the indent format would make difference checking difficult with older revisions. We do cross platform development on VMS, Unix, and Windows and need to be able to debug on all three systems. If we used only tabs, the indents would make the code unreadable in the debugger on some systems. Sure, Windows is flexable enough to handle only tabs but the other systems are not. Changing thousands of files with millions of lines of code is not reasonable, and this is only our code. I'm sure our customers would have the same problems. Microsoft only asked their MVPs which predominately do only Windows development so they don't see the problem (or don't want to) that those of us who do cross platform development have with their decision.
Tabs 8 is a standard.
If everyone uses tabs 8,
then it is easy to move code (and other text files) around.
If everything is portable, and everything is interoperable,
then the OS is just infrastructure, and you can use whichever one you like.
That would be bad for MSFT.
Indent is not a standard: everyone uses whatever they like.
By tying tabs to indent, they scatter tabs all over the map,
which effectively breaks the tabs 8 standard.
Breaking standards promotes lock-in and monopoly.
Microsoft is on the record as doing this to defend against competitive threats.
(http://catb.org/~esr/halloween/).
I wrote that post. It's a jerkwad post. It deserves to be modded down. I'd delete it if I could. Foredecker is a cool dude and deserves better treatment than that. He wasn't astroturfing - he's entitled to put his opinion here too.
Help stamp out iliturcy.
Comment removed based on user account deletion
Until you are working on a piece of code with a friend who wants to be able to view the code with an indent/tab size of 8 and you are just dandy with 2,3, or 4. Now everytime you each commit you will waste some time redoing each others 'spaces' indentation levels or have to remember so send everything through a formatter first...
OR you could just use tabs for indentation and then as long as you use a decent editor that can understand (emacs, visual studio, eclipse, etc) magically you can adjust the display and not the actual characters themselves. And avoid needless whitespace changes in version control.
Yes this dives into space/tabs debate which I have no intention of dragging into here, but I'm making a point that it is NOT simple or trivial or efficient to just keep re-expanding your indentation everywhere you go.
For the life of me I'm trying to grasp what the heck the difference between tab size and indent size... what does it mean for them not to be equal? I'm trying to grasp how the tab size of your code within visual studio has any relationship to its runtime behavior in usage with other products. if you are trying to print a tab as in the character '\t' isnt it just going to get printed however the reciever chooses to interpret the tab character?
And if the other "program" is processing the code itself for you, maybe its time to get that programs creators to creep ahead into the future and embrace the reality that tabs could be of a configurable width..
surely i'm missing something about the difference between the two. Even when I'm using no-tabs and spaces only I don't understand why they would be different
"Jazz isn't dead, it just smells funny" ~Frank Zappa
EdelFactor
They totally break any semblence of WYSISYG formatting.
Not to mention that they will totally screw you when editing makefiles.
If you want to look at the code they way you like it... then I suggest you write it.
I am very small, utmostly microscopic.