In vscode, html and JavaScript are indented to four spaces, but they are automatically formatted and changed to two spaces when saved.

problem description

In

vscode, I have set indentation to four spaces, but when I save it, I automatically format it and change it to two spaces. How can I set it to make it four spaces after automatic formatting?

the platform version of the problem and what methods you have tried

vscode version: 1.29.1

"editor.detectIndentation": false false

related codes

"editor.tabSize": 4,
"editor.detectIndentation": false

what result do you expect? What is the error message actually seen?

how can I set up html, JavaScript or four spaces after automatic formatting?

Dec.14,2021

needs to modify the default configuration of prettier. The default tabWidth of prettier is 2, so you need to add "prettier.tabWidth": 4 to the setting.json of vscode.


there is an option at the bottom of the software that can be indented according to the space tab character, which will eventually prevail
clipboard.png

.
Menu