Skip to content
| Marketplace
Sign in
Visual Studio Code>Formatters>SmartRulerNew to Visual Studio Code? Get it now.
SmartRuler

SmartRuler

Josh Endries

|
15 installs
| (0) | Free
Displays line-wrap reminders while considering indentation.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

SmartRuler

SmartRuler adds vertical bars to any line beyond a configurable length (i.e., a ruler), however SmartRuler will take into consideration indentation and whether or not the line is a comment. This project was an experiment to learn about Visual Studio Code extensions and attempt to make something useful.

The default length is 65 characters. Considering indentation allows one to ensure that lines of textual content are of the configured length regardless of their position. By default, and for unrecognized languages, every line will be checked for length (considering indentation).

If an applicable line extends beyond the limit, one or more vertical bars (right-side borders) will be drawn, based on the configured styles, with the configured number of characters (increment) in between each vertical line.

Example for prose text (plain text):

Text example

Example for code text (C#):

Code example

Optimal Line Length

There are several papers, studies and articles that disuss the optimal line length for human comprehension or readability. Most of these determine that the optimal length/width should be around four inches or the 50-70 character range. The findings vary and font size, type, spacing (e.g. kerning), etc., all have an effect. The 65 character default for this extension was chosen as a middle ground across all the findings.

  • Bringhurst R. The Elements of Typographic Style. Vancouver, BC: Hartley & Marks; 1993.

    "Anything from 45 to 75 characters is widely regarded as a satisfactory length of line for a single-column page set in a serifed text face in a text size. The 66-character line (counting both letters and spaces) is widely regarded as ideal."

  • Baymard Institute. Readability: The optimal line length. Baymard Institute. Accessed September 12, 2025. https://baymard.com/blog/line-length-readability

    "The optimal line length for body text is 50-75 characters per line, including spaces."

  • Line length. Wikipedia. Accessed September 12, 2025. https://en.wikipedia.org/wiki/Line_length

    Several mentions of optimal width and additional references.

  • Bailey, Bob. Accessed September 12, 2025. Published November, 2022. https://www.humanfactors.com/newsletters/optimal_line_length.html

    A collection of even more resources and mentions the four inch optimal width.

  • Dyson MC, Haselgrove M. The influence of reading speed and line length on the effectiveness of reading from screen. Int J Hum Comput Stud. 2001;54(4):585-612. doi:10.1006/ijhc.2001.0458.

  • Tinker MA. Legibility of Print. Ames, IA: Iowa State University Press; 1963.

Development

Building

npm run compile

Packaging

npm run package

Testing

This test pattern can be used to manually test several cases until automated tests are finished.

For prose languages, every line beyond the first should have a marker. Markers for lines 3, 5 and 9 should be indented.

For coding languages, lines 1, 2, 3 and 12 shouldn't have any markers. Lines 4, 5, 6, 8, 9, and 11 should have markers. The markers for lines 3, 5, 6 and 9 should be indented.

123456789 123456789 123456789 123456789
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
    123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
// 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
    // 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
//      123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
/*
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
    123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
*/
/* 123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789 */
123456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789

To-Do

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
© 2025 Microsoft