1. First install Prettier -Code formatter [code formatter] in code
2. Open settings
3. Search for prettier in the search bar and click to edit in settings
4. Add a formatting code when saving Statement
"editor.formatOnSave": true
If an error occurs, it may be that there is no comma at the end of the previous statement, just add it
Recommended related article tutorials: vscode tutorial
The above is the detailed content of How vscode automatically formats code. For more information, please follow other related articles on the PHP Chinese website!