The method of standardizing Code format with one Button in vscode
Editor to share with you the method of vscode one-click standard code format, I believe that most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
The specific methods are as follows:
File-> preferences-> Settings-> {}
You can change the current editor by default in the user settings on the right
Copy the following to the user settings and ctrl + s will complete the specification of the code.
{/ / vscode enables the option to automatically set tabsize based on file type "editor.detectIndentation": false, / / reset tabsize "editor.tabSize": 2, / / # automatically format "editor.formatOnSave": true every time you save, / / # fix "eslint.autoFixOnSave": true in eslint format every time you save / / adding vue supports "eslint.validate": ["javascript", "javascriptreact", {"language": "vue", "autoFix": true}], / / # Let prettier use the eslint code format to verify "prettier.eslintIntegration": true, / / # remove the semicolon "prettier.semi" at the end of the code: false / / # use quotation marks instead of double quotation marks "prettier.singleQuote": true, / / # put a space between the function (name) and the following parentheses "javascript.format.insertSpaceBeforeFunctionParenthesis": true, / / # choose "vetur.format.defaultFormatter.html": "js-beautify-html" according to the user's custom / / # Let the js in vue format "vetur.format.defaultFormatter.js": "vscode-typescript", "vetur.format.defaultFormatterOptions": {"js-beautify-html": {"wrap_attributes": "force-aligned" / / # vue component html code format}}, / / format stylus Need to install Manta's Stylus Supremacy plug-in "stylusSupremacy.insertColons": false, / / whether to insert colon "stylusSupremacy.insertSemicolons": false, / / whether to insert "stylusSupremacy.insertBraces": false, / / whether to insert curly braces "stylusSupremacy.insertNewLineAroundImports": false / / whether to wrap the line "stylusSupremacy.insertNewLineAroundBlocks" after import: whether to wrap the line in false / / two selectors} these are all the contents of the article "vscode one-click standard code format". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!