Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show whitespace characters in Visual Studio Code

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.

like image 439
eirvandelden Avatar asked May 09 '15 13:05

eirvandelden


People also ask

How do you show dots for spaces in VS Code?

You can click on View and then Click on Command Palette or type Ctrl + Shift + P keyboard shortcut. Click on Toggle Render Whitespace. This option can be used to toggle Indentation dots in VSCode.

What is the code for white space?

For example, the common whitespace symbol U+0020 SPACE (also ASCII 32) represents a blank space punctuation character in text, used as a word divider in Western scripts.

How do you get rid of white spaces in VS Code?

Well, place the cursor into the line from where you want to clean it up and then navigate to Edit -> Advanced -> Delete Horizontal White Space or press Ctrl + E , \ . That will automatically remove the additional spaces from your code.

Is it possible to display white space in Visual Studio Code?

Up until recently I had no idea that Visual Studio had the same option to display white space. Jeff Atwood’s recent blog post Whitespace: The Silent Killer had a screen shot on some code showing white space characters, so I hunted around in the Visual Studio toolbars for a little bit and found the option under the Edit menu.

Is there a way to toggle whitespace characters in Visual Studio Code?

For those willing to toggle whitespace characters using a keyboard shortcut, you can easily add a keybinding for that. In the latest versions of Visual Studio Code there is now a user-friendly graphical interface (i.e. no need to type JSON data etc) for viewing and editing all the available keyboard shortcuts.

How to view all whitespace characters in a document?

To view all whitespaces: Before 1.6.0, you had to set editor.renderWhitespace to true: Show activity on this post. It can also be done via the main menu View -> Render Whitespace Show activity on this post. For those willing to toggle whitespace characters using a keyboard shortcut, you can easily add a keybinding for that.

How to display white space characters on the toolbar?

Display white space characters Menu: You can toggle the visibility of the white space characters from the menu: Edit > Advanced > View White Space. Button: If you want to add the button to a toolbar, it is called Toggle Visual Space in the command category "Edit". The actual command name is: Edit.ViewWhiteSpace.


1 Answers

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 
like image 184
revo Avatar answered Oct 02 '22 03:10

revo