How to add a right margin to the Visual Studio Code editor?

Visual Studio-Code

Visual Studio-Code Problem Overview


Is it possible to add a right margin to the Visual Studio Code editor?

I would like to set a margin of 80 characters, but can't find such option in the settings.

Visual Studio-Code Solutions


Solution 1 - Visual Studio-Code

According to the Visual Studio Code's user and workspace settings documentation, you can add rulers which mark specified columns.

Search for "ruler" in Settings. Click on the link to edit the .json file. Add the property below for rule at 80 characters.

Example setting:

// Columns at which to show vertical rulers
"editor.rulers": [80],

Solution 2 - Visual Studio-Code

Navigation to follow

  1. File -> Preferences -> Settings
  2. Select the tab option: Applies to only => 'User' or 'Workspace'
  3. Search for 'rulers'
  4. open the setting.json under 'rulers'
  5. add the line "editor.rulers": [80]

Version I'm using is 1.49.1

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionAlexeyView Question on Stackoverflow
Solution 1 - Visual Studio-CodealexriedlView Answer on Stackoverflow
Solution 2 - Visual Studio-CodeSridharKrithaView Answer on Stackoverflow