

Follow below steps to integrate it with VS Code: It is pretty good tool which format your code whenever you save your code. Today we are gonna use one of such tool called Prettier which support JavaScript, TypeScript, HTML, JSON or many other technologies. Verify that the code file is auto formatted on save.While working with a team formatting code in a consistent style is a big challenge unless your IDE or tool is doing it. You can click on Edit in settings.json to open the file. If you are unable to find setting.json, you can look for Edit in settings.json link in Settings menu. However, this may be different in your machine. In Windows, the default directory is C:\users\AppData\Local\Programs\Microsoft VS Code. Settings.json is found in the installation directory of Visual Studio code. "faultFormatter": "esbenp.prettier-vscode" Step 3: Set Prettier as default formatterĪdd the following property in settings.json. Enable this setting by selecting the checkbox. Use the navigation File > Preferences > Settings. Search for Prettier and install extension.If it is not visible, you can show it by using View > Extensions. This is usually the last option by default in the menu. We’ll use Prettier extension to format code in file once the file is saved. So there is no need to manually format the code. In this article we’ll see how to format the file once we save the changes.

Visual Studio Code is one of the most popular editor. It is advisable to keep the formatting of code in the files uniform. Due to this reason, files in the project could have different formatting. However, every developer has her style of writing code. Our code should be properly formatted as this makes code more readable.
