Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>Insert Line NumberNew to Visual Studio Code? Get it now.
Insert Line Number

Insert Line Number

Anders Liu

|
10,736 installs
| (4) | Free
Insert line numbers to selected lines or the whole document.
Trouble Installing?

Insert Line Number

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.

Screenshot

Features

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.

Extension Settings

InsertLineNumber.formats

InsertLineNumber.formats is an array of InsertLineNumberConfig.Format objects, which have the following properties:


Property: start

Line number of the first line.

Default value: 1
Type: "current" | number
  • "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.

Property: align

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 :'.

Default value: "left"
Type: "left" | "right"
  • "left": Align to left.
  • "right": Align to right.

Property: padding

Padding char to satisfy padding to the width.

Default value: "space"
Type: "space" | "zero"
  • "space": Pad line numbers with whitespaces.
  • "zero": Pad line numbers with 0.

Property: width

Width of each line number.

Note, if a line number were longer than the specified width, it won't be truncated.

Default value: "normal"
Type: "normal" | "alignToLast" | number

"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.


Property: prefix

Perfix would be inserted before the formatted line number.

Default value: ""
Type: string

Property: suffix

Suffix would be inserted after the formatted line number.

Default value: ": "
Type: string

Enjoy!

Categories

Formatters

Tags

line number

Works with

Universal

Resources

  • Issues
  • Repository
  • Homepage
  • License
  • Changelog

Project Details

  • anders-liu/vscode-insert-line-number
  • 4 Pull Requests
  • Last Commit: 4 years ago
  • 1 Open Issues

More Info

Version 1.0.1
Released on 1/3/2019, 3:44:08 AM
Last updated
12/19/2019, 8:27:44 AM
Publisher Anders Liu
Unique Identifier andersliu.insert-line-number
Report Report a concern
CHANGE LOG
VersionLast Updated
1.0.112/19/2019Download
1.0.01/2/2019Download
  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft