Use volar-service-vetur instead of Vetur
时间: 2023-08-31 16:10:47 浏览: 140
Volar Service is a newer language server for Vue.js that provides better performance and more features compared to Vetur. To use it instead of Vetur, you can follow these steps:
1. Install the Volar Service extension in Visual Studio Code.
2. Open your Vue.js project in Visual Studio Code.
3. Remove the Vetur extension if you have it installed.
4. Open the settings.json file for your project.
5. Add the following lines:
```
"vetur.useWorkspaceDependencies": true,
"vetur.experimental.templateInterpolationService": true,
"vetur.format.defaultFormatter.html": "none",
"vetur.format.defaultFormatter.js": "none",
"vetur.format.defaultFormatter.css": "none",
"vetur.format.defaultFormatter.postcss": "none",
"vetur.format.defaultFormatter.scss": "none",
"vetur.format.defaultFormatter.less": "none",
"vetur.format.defaultFormatter.stylus": "none",
"vetur.format.defaultFormatter.ts": "none",
"vetur.format.defaultFormatter.sass": "none",
"vetur.format.defaultFormatterOptions": {
"prettier": {
"singleQuote": true,
"semi": false
}
},
"vetur.validation.template": false,
"vetur.validation.script": false,
"vetur.validation.style": false,
"vetur.format.enable": false,
"vetur.format.defaultFormatterOptions": {
"prettier": {
"singleQuote": true,
"semi": false
}
},
"editor.formatOnSave": true,
"vetur.experimental.templateInterpolationService": true,
"vetur.experimental.templateInterpolationServiceCSS": true
```
6. Save the file.
Now, Volar Service will be used instead of Vetur for language support and code formatting in your Vue.js project.
阅读全文