Visual Studio code - convert spaces to tab and then save in spaces again

I'm coding in a language that has an official formatting tool that uses 2 spaces. While I think using the agreed standard is good, it's really straining to read the code. Is there a way to automagically display it as 8 spaces, or convert to 8 spaces/2tabs when loading the file and then save it to 2-spaces again afterwards?

1 Answer

You can use find and replace (CTRL + H). In find field you type 4 spaces, and in replace with field type one tab; then press replace all.

enter image description here

Or you can use some online code beautifier script and it will work.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like