I am working on a React project using a Visual Studio Code. When I press Ctrl+S in the Visual Studio Code to save file, it removes all the JavaScript formatting or scatters all the code in the file.
Any help would be appreciated.
Try disable extensions for auto-formatting javascript code. Sometimes Beautify, JS-CSS-HTML Formatter can mess things up.
Maybe auto-formatting is on in settings as well. Check File > Preferences > Settings and look at the "User settings"-tab. Look if "editor.formatOnSave" is set to 'true', change that to 'false' in that case.
Hope that helps. If not, please send a list of your activated extensions.
You disable it "Format On Save"
To expand on Tuxedo Joe's answer, your issue might be with your formatter extension:
Check if "Format On Save" is disabled
Disable formatting on save in formatter.json
:
formatter.json
set "onSave" to falseformatter.json
select language mode by clicking on your bottom right hand from javascript/html to react
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With