Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

People also ask

How do I add formatting to Visual Studio code?

VS Code has great support for source code formatting. The editor has two explicit format actions: Format Document (Ctrl+Shift+I) - Format the entire active file. Format Selection (Ctrl+K Ctrl+F) - Format the selected text.

How do you set line length or code?

In VSCode, go 'Code -> Preferences -> Settings' and search for "python formatting black args". A few notes about line lengths in Python: PEP8 recommends a line length of 79 characters (72 for docstrings) Black sets line lengths to 88 characters by default.


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],

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