The line number (position) of a line of text or code inside a file, often for debugging.
Questions tagged [line-numbers]
369 questions
16
votes
2 answers
Preserving original StackTrace/LineNumbers in .NET Exceptions
Understanding the difference between throw ex and throw, why is the original StackTrace preserved in this example:
static void Main(string[] args)
{
try
{
LongFaultyMethod();
}
catch…

Sam
- 173
- 6
15
votes
3 answers
PhpStorm background color line number
How to change background color of left panel (where line numbers). I want set it to dark. Because I using dark theme, but it left panel looks ugly with it :(

woozly
- 1,363
- 1
- 14
- 24
14
votes
1 answer
Adding line numbers on Visual Studio
How do I add line numbers in Microsoft Visual Studio?

Alumina Brain
- 149
- 1
- 1
- 4
13
votes
6 answers
How do I extract lines from a file using their line number on unix?
Using sed or similar how would you extract lines from a file? If I wanted lines 1, 5, 1010, 20503 from a file, how would I get these 4 lines?
What if I have a fairly large number of lines I need to extract?
If I had a file with 100 lines, each…

monkeyking
- 6,670
- 24
- 61
- 81
13
votes
1 answer
Current file line number with $. variable
I understand that I can get the current line number of a file I am looping through with the builtin variable $.. As an experiment, I used that to prefix each line in a file with the value of $. (the current line number). However, this did not work…

Friedrich 'Fred' Clausen
- 3,321
- 8
- 39
- 70
13
votes
1 answer
C# Exception Line Number Is Always Zero (0)
I published my project in debug mode and put both dll and pdb files in my server,
now i want to get exception line number using these codes :
System.Diagnostics.StackTrace trace = new System.Diagnostics.StackTrace(ex, true);
…

SilverLight
- 19,668
- 65
- 192
- 300
12
votes
3 answers
vim: display relative linenumbers starting with 1
In vim, I like using relative linenumbers to see how many lines I need to yank, delete, whatever.
However, when using relative linenumbers, the current line is 0, which means, if I want to yank until the line with number 3, I have to type 4yy, which…

Pmarcoen
- 1,216
- 4
- 20
- 33
12
votes
9 answers
Is there an easy way to tell which line number a file pointer is on?
In Python 2.5, I am reading a structured text data file (~30 MB in size) using a file pointer:
fp = open('myfile.txt', 'r')
line = fp.readline()
# ... many other fp.readline() processing steps, which
# are used in different contexts to read the…

Mike T
- 41,085
- 18
- 152
- 203
12
votes
2 answers
How to set relative line numbers in Doom Emacs
I know that you can toggle line numbers with the key combination SPC + t + l but it changes back to absolute line numbers when restarting Doom Emacs. How can I configure Doom Emacs to set relative line numbers every time I start emacs?

n1ks
- 2,188
- 2
- 12
- 12
12
votes
1 answer
Stack trace with incorrect line number
Why would a stack trace show "line 0", but only for one frame in the stack trace?
eg.
...
at System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior behavior)
at System.Data.Common.DbCommand.System.Data.IDbCommand.ExecuteReader()
at…

adrianbanks
- 81,306
- 22
- 176
- 206
12
votes
1 answer
How can I send line number from Python traceback into vim?
I can parse out the paths to the files of a Python traceback, and I can then send those on to Vim using -p on the command line, so that they are opened one file per tab. So I end up with a command like, for example
vim -p main.py module.py…

jalanb
- 1,097
- 2
- 11
- 37
11
votes
3 answers
Move Cursor Up or Down Multiple Lines at once in VS Code
Note: I have searched in Google and other SO posts, but none of them have helped me.
I know that we can move up or down with Alt+Arrow. Is there a way to move, let's say 25 lines up, at once? I don't want to press Alt+↑ 25 times.
Is there a plugin…

Sid110307
- 497
- 2
- 8
- 22
11
votes
4 answers
displaying line number in rich text box c#
I have a Multiline richtextbox control into which i want to integrate the feature of adding a line number. i have considered many approaches
Add a label and updating the line numbers as the line count changes
Add a picturebox along with to draw…

Anirudh Goel
- 4,571
- 19
- 79
- 109
11
votes
2 answers
Setup Visual Studio 2005 to print line numbers
How can I get line numbers to print in Visual Studio 2005 when printing code listings?

Christopher Mahan
- 7,621
- 9
- 53
- 66
11
votes
1 answer
Is there any #pragma or similar directive for generated C# code to match template code line numbers to C# line number?
I have a templating system that looks similar to old-style ASP code. I run this through a class that rewrites the entire thing into C# source code, compiles, and finally executes it.
What I'm wondering is if there is some kind of #pragma-like…

Lasse V. Karlsen
- 380,855
- 102
- 628
- 825