question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add `editor.contentLeftPadding` to add padding between the `editorGutter` and `editor`.

See original GitHub issue

Note: Please see BOTH screenshots below and also TWO possible solutions at the end!

Please add some option like editor.contentLeftPadding or whatever you want to name it, to resolve at least these two issues:

  1. Currently in VS Code, the gutter and the code editor are so close that while clicking in the beginning of a line one can accidentally click on collapse button in the gutter region which sometimes really bother the user.

  2. When a user apply a different background color to gutter for either theming purpose or to show that it’s not part of the editor region, the code in the editor and also the vertical lines between the first pair of curly braces of code blocks basically touch the gutter. See the following first screenshot.

image

If we had editor.contentLeftPadding then the user could just add that to settings.json like this:

"workbench.colorCustomizations": {
        "editor.contentLeftPadding": 8px;
        "editorGutter.background" : "#454545",
    },

which could separate code from the gutter and look like this:

image

There are two ways to solve this issue:

  1. Adding editor.contentLeftPadding setting. It will not create any changes to VS Code by default as it would take effect only when the user use this setting, hence, those users who are used to the current user interface of the VS Code will not notice this change.
  2. However, if a little padding is added by default in the VS Code , it will not be much noticeable to those users who are used to the current look and feel of the user interface while resolving the above mentioned issues at the same time!

As VS Code doesn’t allow users to add custom CSS in it so a setting like editor.contentLeftPadding or built-in default padding for editor’s content is required.

If built-in default padding is added to VS Code then a setting to remove that built-in default padding can also be added so that the user can remove it if the user doesn’t like it, just like the following settings to remove folding, glyphMargin and lineNumbers:

"editor.folding": false,
"editor.glyphMargin": false
"editor.lineNumbers": "off",

Proof of concept Implementation and Observation

For proof of concept, I added the following CSS code to the end of this CSS file /usr/share/code/resources/app/out/vs/workbench/workbench.desktop.main.css:

.monaco-editor .lines-content {
    padding-left: 8px;
}

which produces the following neat and required result, such that, now neither I can’t accidentally click on folding buttons nor the code touches the gutter:

image

But I noticed that unlike HTML textarea tag which allows a user to click in the padding area to place cursor at the start of the nearest line no matter how wide padding you set, in VS Code I can’t place the cursor at the start of the line by clicking in the padding region which might be desirable by some users.

My VS Code settings.json:

The following are the settings for those who wonder what settings I have for the colors of gutter, tabs and breadcrumb of my VS Code. Note that these color settings look best with Dart+(default dark) theme.

{
    // Look best with "Dart+(default dark)" theme.
    "workbench.colorCustomizations": {
        "editorGutter.background" : "#454545",

        "editorGroupHeader.tabsBackground": "#454545",        
        "tab.inactiveBackground":  "#454545",

        "tab.activeBackground": "#5b5b5b",
        "breadcrumb.background": "#5b5b5b",     
    },
}

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:60
  • Comments:14 (2 by maintainers)

github_iconTop GitHub Comments

9reactions
mckeedcommented, Nov 24, 2021

There are already settings for editor.padding.top and editor.padding.bottom, so the setting should be editor.padding.left and should result in the same amount of spacing as those do.

2reactions
shujaatakcommented, Oct 12, 2022

@alexdima @bpasero Waiting for a year and counting 🥱

Read more comments on GitHub >

github_iconTop Results From Across the Web

Add left space/margin/padding in VS Code editor window ...
I tried "editor.glyphMargin" , but this will only increase the space on the left of the line numbers, not between the line numbers...
Read more >
How To Add Paddingtop For Monaco Editor? - ADocLib
Using HTML to Add Padding Click Edit Switch to HTML Editor Locate the HTML code ... contentLeftPadding to add padding between the editorGutter...
Read more >
Double Line Numbers - Visual Studio Marketplace
contentLeftPadding to add padding between the editorGutter and editor. Acknowledgment. This extension is inspired by extr0py's Relative Line ...
Read more >
Theme.json layout and spacing options - Full Site Editing
Can I add a blockGap value to a single block type? Spacing presets. How to use the default spacing scale; How to add...
Read more >
Editor X: Adding Padding to Containers | Help Center | Wix.com
Add padding to containers to create a space between the edges (top, bottom or sides) and the content inside. Learn more about:Adding padding...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found