Search code examples
javascriptvisual-studio-codeformattingindentation

How to display more tab space in Visual Studio Code? (without actually increasing the indent size)


In js, 2 spaces are the golden standard for indent size. With that said, if one were to try and share some code that had 3 or 4 spaces, that would probably annoy the heck out of whoever else is needing to use it.

The problem is that I have a pretty tough time visually seeing two-space indents, specifically when the start and end of an "indent block" are a screen tall or more (also, I have dyslexia, and this is probably amplifying this difficulty.) Regardless, I just spend nearly an hour trying to fix a "bug" that ended up just being me placing a variable in the wrong scope because I couldn't see the indent. I can't stand two spaces, it's too small! Having a larger indent would prevent problems like this from occurring in the future.

So, is there any way to display more than two indent spaces without having to actually change the indent size? (so that when I push or do a pull request on github, the resulting document only has 2 space indents.)


Solution

  • There is an extension, called indent-switcher, which does exactly what you need. You can manually change the indent from 2 to 4 or from 4 to 2.

    I'm not sure if this indent will affect your code when you pull or push it to github. But you could just change it from 2 to 4 while working on it and change it from 4 to 2 when you are finished. You can also bind the commands to a keyboard shortcut. There is also another extension called indent-rainbow. This could also come in handy for you.