# npm
npm i
# yarn
yarn- Install
Vue Syntax Highlight,LSPandLSP-vuefrom Package Control. - Open
Preferences: LSP-vue Settingsfrom the Command Palette. - In the user settings, on the right side, set the following options:
{
"initializationOptions": {
"config": {
"vetur.experimental.templateInterpolationService": true,
"vetur.useWorkspaceDependencies": true,
},
},
}- I prefer to use
vetur.useWorkspaceDependenciesso that the project-local dependencies (liketypescript) are used instead of the ones that are bundled with Vetur (which are potentially outdated). vetur.experimental.templateInterpolationServiceenables type-checking in thetemplateblock. It's very helpful during development but it requires a bit of help with manual type annotations to work properly (due to limitation of the Vue Options API. Also seevetur's FAQ on the matter). Seesrc/example.vuefor some hints on how to annotate properly.
Eslint is useful during development to check and auto-fix the code on saving. This project bundles quite extensive and opinionated set of rules in the .eslintrc.js file.
- Install
LSP-eslintfrom Package Control. - Open
Preferences: LSP Settingsfrom the Command Palette. - In the user settings, on the right side, set the following options:
"lsp_code_actions_on_save": {
"source.fixAll.eslint": true,
// Optionally you can enable autoFix for all language servers that support it with:
// "source.fixAll": true,
},- Saving the file will automatically fix most issues found by eslint (requires ST4+).
A typical Vue/Nuxt project often includes pure javascript or typescript files so it's useful to install a Typescript language server to type-check those too.
- Install
LSP-typescriptfrom Package Control.
It's highly recommended to install the LSP-json package from Package Control which can validate and provide completions for various settings in Sublime Text (including LSP-vue and LSP-eslint) and standalone JSON files like tsconfig.json.