1

I am using React to build a front end, using the create-react-app package to generate a boilerplate. When going into any js file that has embedded HTML, when I save, the HTML goes all askew, everything compiles correctly, but the formatting looks horribly off. The image below shows how my code looks after save...

enter image description here

I know I could go to my settings and set

"editor.formatOnSave": true

However, I lose formatting on saving on all other files, which I would prefer to have.

Are there any extensions/settings so that when I save a js file with embedded HTML that it formats the HTML code?

mcclosa
  • 943
  • 7
  • 29
  • 59
  • 1
    Check the same issue here – https://stackoverflow.com/questions/44993808/visual-studio-code-changes-format-react-jsx – chuve Sep 04 '17 at 20:33
  • @chuve Yes, it was an installed formatting extension `Beautify` causing this, noticed just before you posted your comment – mcclosa Sep 04 '17 at 20:35

1 Answers1

1

I found the cause of this for anyone that may come across it.

The extension Beautify was causing the code for format incorrectly.

mcclosa
  • 943
  • 7
  • 29
  • 59