Home >Development Tools >VSCode >How vscode organizes code
How to organize the code in vscode:
1. Use the code formatting function of vscode to organize it. The shortcut keys for formatting the code in vscode are as follows:
Use shortcut keys in Windows environment: Shift Alt F
Use shortcut keys in Mac environment: Shift Option F
Use shortcut keys in Ubuntu environment: Ctrl Shift I
2. Use plug-in to format code:
Example:
Requires plug-in: eslint
Add in settings:
"eslint.autoFixOnSave": true, "eslint.validate": [ "javascript", "javascriptreact", { "language": "html", "autoFix": true }, { "language": "vue", "autoFix": true } ],
eslint.autoFixOnSave is used to automatically format when saving, but only supports javascript .js files by default.
eslint.validate is used to configure the file type used.
Then when you save the code, it will be automatically formatted into eslint style (it needs to be saved multiple times).
Recommended related articles and tutorials: vscode tutorial
The above is the detailed content of How vscode organizes code. For more information, please follow other related articles on the PHP Chinese website!