This topic has been discussed before in Why are there no line numbers in the code listings?. The most powerful reason that prevents the implement of line numbers is changing code lines numbers and that will make regarding a line number cause confusion.
Numbering lines of code snippets could be maintained using Number Anchors
that would dynamically update the line number regarded in the ordinary body text. Some thing like the flowing:
In the following function I have an issue with line [L:500]:
function doSomeThing(x){
if (x){
alert("There is no x in Line 3") [L:500]
}
}
In the above example [L:500] in body text should be printed as 3
which is equals to line number in which [L:500] is found in the code. Also, [L:500] should not be printed in the code on reading but it should be displayed during edit.
Suppose, some one will edit the code to be like the following:
function doSomeThing(x){
if (x){
// Explanation comment!
alert("There is no x in Line 3") [L:500]
}
}
Here the [L:500] should be dynamically changed to be 4