This extension is used to insert line number to a text document which is being edited.
Note, This extensions inserts real pure text-based line numbers to each line, so it's typically used for code samples for easily indicating the metioned lines; it's not suitable for real code file.
The line numbers can be inserted to selected lines or the whole document if no any selected lines.
User can select different formats among multiple predefined formats, which can be defined in settings.
InsertLineNumber.formats
is an array of InsertLineNumberConfig.Format
objects, which have the following properties:
Line number of the first line.
"current"
: Starts from the real current line number. For example, user selects line 10-15 in the editor, line numbers 10-15 will be inserted to these lines.number
: Starts from the given number. For example, when the 'start' is set to 1, and user selects line 10-15 in the editor, line number 1-6 will be inserted to these lines.
Alignment of the line number.
Note, The alignment only apply to the formatted number, no matter the perfix and suffix. For example, when prefix is 'C_' and suffix is ':', the result may be 'C_1 :' or 'C_12 :'.
"left"
: Align to left."right"
: Align to right.
Padding char to satisfy padding to the width.
"space"
: Pad line numbers with whitespaces."zero"
: Pad line numbers with 0.
Width of each line number.
Note, if a line number were longer than the specified width, it won't be truncated.
"normal"
: No padding, keep the line numbers as-is.
"alignToLast"
: Pad the line numbers to the last (longest) one.
number
: Pad the line numbers to the given width.
Perfix would be inserted before the formatted line number.
Suffix would be inserted after the formatted line number.
Enjoy!