How to change font size in VS Code sidebar?

2019-04-04 06:11发布

问题:

Querying for fontsize in User Settings window yields only settings for:

  • editor panes,
  • suggest widget,
  • markdown preview,
  • integrated terminal

as you can see below:

Doing the same for sidebar gives even poorer results:

Having fonts of different sizes in editor panes and sidebar looks... let's settle with: not too nice. Have I just found the greatest omission of this awesome tool?

回答1:

This has been a feature request for some time. The short answer is right now there's no VSCode setting that allows you to customize the sidebar font size. There is a hacky workaround solution proposed by @lindesvard in the same issue thread that involves using the Custom CSS and JS Loader extension to load in a custom CSS file that modifies the sidebar styling if you're willing to experiment with it.

To get this working follow the Getting Started section in the extension details, then add URLs to your custom files to the "vscode_custom_css.imports": [""] array. (Note that on Windows mine looks like the following: "vscode_custom_css.imports": ["file:///C:\\dev\\vscode-styling.css"])

Below are before and after adding the CSS mentioned by @PSVapour in a later comment:

Note that this also affects the command palette font.



回答2:

Mihai Chelaru's answer presents a way to do more than just adjust the sidebar's font size. This, however, comes with a price of a bit of fiddling, possibly more than you'd be ready for, if the only thing you were interested in was the simple act of changing the sidebar's font size. So here's a simpler solution.

Just zoom the whole VS Code's UI in or out with CTRL++ or CTRL+- respectively and than adjust font sizes we do have control over in settings.json file, i.e.:

  • editor.fontSize,
  • editor.suggestFontSize,
  • markdown.preview.fontSize,
  • terminal.integrated.fontSize

so everything matches. That's it.



回答3:

Just want to add to the discussion, If you set:

"window.zoomLevel": "your number",

In my case I started with zero, you can use that as sort of a baseline:

 "editor.fontSize": 14,
  "editor.tabSize": 2,
  "terminal.integrated.fontSize": 14,
  "window.zoomLevel": 0,
  "[Log]": {
    "editor.fontSize": 14
  },

And then tweaked until I was happy. Hope this helps!