Render whitespace in vscode
Introduction
One of the most missed style issues in code reviews is the use of mismatching indentation styles in code. It is important to always use either tabs or spaces (we prefer spaces).
The following image shows a file that appears to have the correct indentation
However if we render the whitespace it will show this:
Clearly line #4 is indented using 4 spaces, and #5 is using a tab.
While doing code reviews, a diff will not show it as the editor does, so it will show something like this
diff --git a/main.c b/main.c index e69de29..b8219bd 100644 --- a/main.c +++ b/main.c @@ -0,0 +1,6 @@ +#include <stdio.h> + +int main() { + printf("Hello, World!\n"); + return 0; +}
Which is clearly incorrect.
Instructions
In vscode go to File -> Preferences -> Settings
Then search for 'whitespace' in the search bar and select Editor: Render Whitespace -> Choose 'all'