Show whitespace characters in Visual Studio Code

2020-02-07 14:27发布

Is it possible to show whitespace characters, like the space character, in Visual Studio Code?

There doesn't appear to be an option for it in the settings.json (though it is an option in Atom.io), and I haven't been able to display whitespace characters using CSS.

11条回答
叛逆
2楼-- · 2020-02-07 14:41

Show whitespace characters in Visual Studio Code

change the setting.json, by adding the following codes!

// Place your settings in this file to overwrite default and user settings.
{
    "editor.renderWhitespace": "all"
}

just like this!
(PS: there is no "true" option!, even it also works.) enter image description here

查看更多
爷、活的狠高调
3楼-- · 2020-02-07 14:42

The option to make whitespace visible now appears as an option on the View menu, as "Toggle Render Whitespace" in version 1.15.1 of Visual Studio Code.

查看更多
Root(大扎)
4楼-- · 2020-02-07 14:45

Hit the F1 button, then type "Toggle Render Whitespace" or the parts of it you can remember :)

I use vscode version 1.22.2 so this could be a feature that did not exist back in 2015.

查看更多
成全新的幸福
5楼-- · 2020-02-07 14:45
  1. Open User preferences. Keyboard Shortcut: CTR + SHIFT + P -> Preferences: Open User Settings;

  2. Insert in search field Whitespace, and select all parameter enter image description here

查看更多
闹够了就滚
6楼-- · 2020-02-07 14:46

It can also be done via the main menu View -> Render Whitespace

查看更多
混吃等死
7楼-- · 2020-02-07 14:50

VS Code 1.6.0 and Greater

As mentioned by aloisdg below, editor.renderWhitespace is now an enum taking either none, boundary or all. To view all whitespaces:

"editor.renderWhitespace": "all", 

Before VS Code 1.6.0

Before 1.6.0, you had to set editor.renderWhitespace to true:

"editor.renderWhitespace": true
查看更多
登录 后发表回答