I recall seeing a request for this in meta SO in the pass, but for various reasons that escape me at the moment, there were no plans to do that. Should this be reconsidered for code review considering there'll probably be more code snippets posted here?
Perhaps preferably have an option to toggle them on and off to make copy-paste easier.
Edit: I got quite a few responses so I'll just summarized it here. The general consensus agrees that some form of line numbering should exist to help with code readability. There are some good suggestions on exactly how it should work:
- The starting line number should be settable by the user. @Hailwood's suggestion
- Line numbering automatically kicks-in after x lines of code. @cbrulak's suggestion
The primary concern about this feature is that the line numbering can go out-of-sync or even reference non-existing code if the original poster heavily modifies his question or answer.
In spite of this concern, my personal feeling is that having line numbering in code snippets would make this site easier to use than if we were to not have it. As such, we should carefully consider possible solutions to the concern stated above rather than not implement it.