views:

424

answers:

8

Seems totally backward to me that such an excellent IDE would hide line numbers by default. This seems like an obvious oversight, or poor default.

Which means I'm missing something - because in the VS dev team vs Me, I know who has more experience.

So what am I missing? Why would I -not- need to see line numbers in code?

+1  A: 

Visual studio allow many ways of seeing your code. You can use the searches and drop downs for example. Line numbers may not mean anything to you if you have many named small functions for example. So though I like them its not really an issue is it?

Preet Sangha
+2  A: 

Its a user preference thing , there is no right or wrong way just create a customs settings file that has it turned on so that you don't have to remember to set it every time (Though i am sure this is only ever done once in a while since you rarely re install VS)

RC1140
+4  A: 

A far as I am concerned line numbers are just more screen clutter - I don't see any point in them.

What do you want them for? You're not programming in some 1980s version of BASIC are you?

Dipstick
even if he did, line numbers have nothing to do with numeric line labels
ldigas
+7  A: 

The only time I'm interested in line numbers is when I've given a specific one (e.g. in a stack trace). At that point I want to go to that particular line (which I can do directly) but I don't need to see the surrounding line numbers.

I value the contents of my screen, and line numbers would just be wasting it for me.

I think the bigger question is to ask yourself why you would want to see line numbers. Why are they important to you? In what situations do you need to see all the line numbers for the current page, rather than just the current line (which is displayed in the status bar)?

Jon Skeet
Agreed. Ctrl + G is the perfect solution to the stack trace situation.
Jeff Wilcox
maybe you don't need them for languages that hold your hand...
Matt Joiner
@Anacrolix: Care to give more details? What kind of handholding is relevant here? Could you give an example of a language where it's more important to display line numbers (other than when they're used as labels of course)?
Jon Skeet
Languages that require special instrumentation for debugging purposes, particularly due to lack of virtual machine abstractions (C/C++/Bash), and more than a single target execution environment (Python). Under such conditions, one can't make assumptions about whether or not the programmer's environment will prettify execution state, such as jumping to the corresponding SLOC and displaying a visual call stack.
Matt Joiner
@Anacrolix: That doesn't feel like it's a feature of the *language* though - it's a feature of the *tool*. And as such, I've seen far more editors which support "jump to line" (which even *Notepad* supports) than support line numbers. Why would an editor which *does* support "jump to line" need to also support displaying all line numbers - or rather, how would such an ability compensate for other tools *not* supporting those features?
Jon Skeet
A: 

Line numbers can be of use for one and pain on the screen for another. And all they can help for: quick access to the exact line mentioned in exception stack log and easy way to implement changes introduced by code review.

Anyway, even if there are more usages, there are even more developers who do not use them. And that's a concern of VS developers: they give us means, but they don't switch them all on by default.

terR0Q
+2  A: 

Line numbers are essential when pair programming. When two people are working together, it is very helpful to say something to the effect of "There is an issue on line 35"

Michael Valenty
I can understand "useful" in this case, but really "essential"? I've certainly pair programmed without ever talking about line numbers. I'll usually say "in method XXX" or "when you do XYZ you're not doing ABC" - or just point at the screen.
Jon Skeet
Only essential if you don't like fingerprints on your screen or armpits in your face when your coworkers is reaching to point something out :)
Michael Valenty
+1  A: 

Given that there has to be a default, then the most common preference would be the obvious one, and that would be 'off' by default.

Although I could easily do without them, personally I like line numbers because I tend to a) Orientate myself in a code file using them, b) Use them when talking to fellow programmers about code as the quickest way to get them to a specific line of code we're discussing and c) To give a whiff of code smell and remind me of how large a particular code file is getting that I am working on.

Gordon Mackie JoanMiro
+1 - the lack of orientation is what throws me off when they're hidden, i'm used to knowing about where I am in a file by what line i'm on.
nailitdown
@nailitdown: Why is that important to you? And doesn't the scrollbar show you roughly where you are relative to the size of the file? The status bar shows you the line containing the cursor... I'm still struggling to see why I need to know the line numbers for *every* line.
Jon Skeet
Jon - It's not about "everyone needs line numbers".. It's just a habit of mine - I glance at the line numbers to get a reference of where I am, "OK x() is around 140, y() is around 320." then i can flick around to other parts of the system and flick more or less straight back to where i was. I'm very keyboard-focused so I haven't yet fully adopted the VS drop-downs for going straight to a particular method.
nailitdown
Doesn't VS have keyboard shortcuts for things like jumping to a specific method? Surely, it must have... says someone who has only used Eclipse.
Per Wiklander
+2  A: 

What does it matter, as long as there is an option to show or hide them?

My preference is to turn them off - I think they are usually a waste of valuable screen space. You can see which line you're on in the status bar, and you can goto (ctrl+G) any line. But there are times when they can be useful.

Jason Williams