Reputation: 303
Is there a way to make Volar extension to format code in script setup? I'm not using Vetur because it is not compatible enough with vue 3 and its new syntax.
Upvotes: 9
Views: 15342
Reputation: 146
Add volar extensions according to the nuxt3 official document as shown in the link. (https://vuejs.org/guide/typescript/overview.html)
And add the code below to .vscode/setting.json at the top of the project.
"[vue]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "Vue.volar"
},
If it doesn't apply right away, press the command + shift + p key to run the command window, and then run the > Developer: Reload Window command.
Upvotes: 13