'How to auto indent code when opening the file in VS code?

It is possible in the setting or via a plugin the make a file (html, css or php) automatically add whitespace (auto-indentation) on opening? I know that I can alter the setting to automatically remove whitespace on save, but I think I will loss the visual when editing.

I saw @rioV8 was not clear where I want the whitespace be added. So basically before each line of code (just like when auto-indent when hit enter). But apply to a single line of code. example:

<html><head>some code</head><body><div></div><div><div><div></div></div></div><div></div><div></div><div></div></body></html>

being converted to this when the file opens:

<html>
  <head>some code</head>
  <body>
    <div></div>
    <div>
      <div>
        <div></div>
      </div>
    </div>
    <div></div>
    <div></div>
    <div></div>
  </body>
</html>

NB: I’m using the latest stable build of VS code.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source