My vscode is equipped with a vetur plugin. The custom configuration is as follows:
"vetur.format.options.tabSize": 2,
"vetur.format.defaultFormatterOptions": {
"js-beautify-html": {
"wrap_attributes": "auto"
},
"prettyhtml": {
"printWidth": 10000,
"singleQuote": false,
"wrapAttributes": false,
"sortAttributes": false
}
},
"vetur.format.defaultFormatter.html": "js-beautify-html"
Others are default configurations
The vetur version number is 0.14.4
and the vscode version number is 1.30.1
.
When programming with vuejs, it probably writes more than 300 lines. After the formatting shortcut is pressed, the cursor is not in the formatted place. It is positioned in front of the </script>
tag. It is very painful. Now you have to remember it every time. The number of lines in the formatted place, then jump back myself
"vetur.format.defaultFormatterOptions": {
"js-beautify-html": {
"wrap_line_length": 120,
"wrap_attributes": "auto",
"end_with_newline": false
}
},
"vetur.format.defaultFormatter.html": "js-beautify-html",
"vetur.format.defaultFormatter.js": "vscode-typescript",