How to disable Prettier in VSCODE

How to disable Prettier in VS Code: an example of how to disable Prettier in VS Code for better control over your code.

Disabling Prettier in VSCODE

Prettier is a popular code formatting tool for JavaScript, HTML, CSS and other languages. It is integrated in many code editors, including Visual Studio Code (VSCode). While Prettier is a great tool, it is not always the right choice for every project. If you want to disable Prettier in VSCode, there are a few different ways to do it.

Disable Prettier in Settings File

The simplest way to disable Prettier in VSCode is to edit the settings file. To do this, open the command palette (Ctrl+Shift+P) and type “Preferences: Open Settings (JSON)”. This will open the settings.json file. In this file, you can add the following line to disable Prettier:

"editor.formatOnSave": false

This will disable the automatic formatting of code when you save a file. You can also add the following line to disable the Prettier formatter entirely:

"prettier.disableLanguages": ["javascript", "typescript"]

This will disable Prettier for all JavaScript and TypeScript files. You can also add other languages to the array if you want to disable Prettier for them as well.

Disable Prettier in Workspace Settings

If you want to disable Prettier only for a specific workspace, you can do so by opening the workspace settings (File > Preferences > Settings). Here, you can add the same settings as above to disable Prettier for this workspace only.

Disable Prettier from Command Palette

You can also disable Prettier from the command palette. To do this, open the command palette (Ctrl+Shift+P) and type “Prettier: Disable Formatting”. This will disable Prettier for all files in the current workspace.

Conclusion

Disabling Prettier in VSCode is easy and can be done in a few different ways. You can disable it in the settings file, in the workspace settings, or from the command palette. Whichever method you choose, you can be sure that Prettier will no longer be formatting your code.

Answers (0)