Skip to content
| Marketplace
Sign in
Visual Studio Code>Visualization>Comment RulersNew to Visual Studio Code? Get it now.
Comment Rulers

Comment Rulers

nineteendo

|
586 installs
| (2) | Free
Comment Rulers is a Visual Studio Code extension that helps you keep your code's comments within a specified length by visualizing where the comment line length reaches 80 characters. The extension adds a red line at the end of the 80th character position of each comment line, allowing you to easily
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

Comment Rulers

Comment Rulers is a Visual Studio Code extension that helps you keep your code's comments within a specified range by visualizing where the comment lines should start and end.

The extension adds green lines at the first and 80th character positions, allowing you to easily identify and adjust comments that aren't in the desired range.

With Comment Rulers, you can ensure that your comments are concise and easy to read, improving the readability and maintainability of your codebase.

Features

Here's an example of what Comment Rulers looks like in action: features

Requirements

None

Extension Settings

This extension contributes the following settings (which can be overwritten for every programming language):

  • comment-rulers.blockCommentDelimiters: The delimiters for block comments.
  • comment-rulers.enabled: Enable/disable drawing comment rulers.
  • comment-rulers.escapableChars: Escapable delimiter characters.
  • comment-rulers.inlineCommentDelimiters: The delimiters for inline comments.
  • comment-rulers.maxCommentLineLength: The maximum length of a comment line.
  • comment-rulers.multiLineStringDelimiters: The delimiters for multi-line strings (to ingore included comment delimiters).
  • comment-rulers.placeholderChar: The placeholder character to align the rulers (CANT BE A SPACE).
  • comment-rulers.placeholderColor: The CSS color of the placeholder character.
  • comment-rulers.rulerColor: The CSS color of the rulers.
  • comment-rulers.rulerWidth: The CSS border-width of the rulers.
  • comment-rulers.singleLineStringDelimiters: The delimiters for single-line strings (to ingore included comment delimiters).

Examples

To configure this extension for individual languages, use Ctrl+Shift+P and >Preferences: Open User Settings (JSON).

  • Enabling the extension for Java, Python and Ruby:

    {
        // [language_1][language_2]...[language_n]
        "[java][python][ruby]": {
            "comment-rulers.enabled": true
        }
    }
    

    get_started

  • Default settings for the top 20 most popular programming languages

  • Comment tests for the top 20 most popular programming languages

  • Messing with other settings:

    {
        "comment-rulers.maxCommentLineLength": 60,
        "comment-rulers.placeholderChar": "=",
        "comment-rulers.placeholderColor": "blue", // CSS color
        "comment-rulers.rulerColor": "red", // CSS color
        "comment-rulers.rulerWidth": "2px" // border-width
    }
    

    custom_settings

Known Issues

  • Rulers can be misplaced: ruler_misplacement

  • Comments in string templates aren't supported:

    let num = 12;
    let str = `${num /* comment */}`;
    

    Expected: string_template_undetected

  • Delimiters can't be configured to be just indented: This heredoc is terminated early, since it's not possible to configure that DOC can only be indented <<-DOC (vscode is wrong here):

    <<-DOC
    A heredoc ended with DOC
    DOC
    

    Expected: heredoc_terminated_early

  • Incorrect tab indentation isn't handled properly: incorrect_tab_indentation

Release Notes

1.0.5 (Apr 18. 2023)

  • Made end delimiters of strings configurable
  • Added ruler where the comment line should start
  • Added examples
  • Added default configuration for top 20 most popular programming languages
  • Added comments tests for top 20 most popular programming languages

See changelog for all changes.


Enjoy!

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