Skip to content

Commit

Permalink
docs: update documentation for Volar >= 2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
WhyNotHugo committed Mar 4, 2024
1 parent 7f5cf11 commit c535630
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
31 changes: 31 additions & 0 deletions lua/lspconfig/server_configurations/tsserver.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,37 @@ Here's an example that disables type checking in JavaScript files.
]
}
```
# Vue support
As of 2.0.0, Volar no longer supports TypeScript itself. Instead, a plugin adds
adds Vue support to this language server.
```lua
require'lspconfig'.tsserver.setup{
init_options = {
plugins = {
{
name = "@vue/typescript-plugin",
location = "/usr/local/lib/node_modules/@vue/typescript-plugin",
languages = {"javascript", "typescript", "vue"},
},
},
},
filetypes = {
"javascript",
"typescript",
"vue",
},
}
```
`location` MUST be defined. If the plugin is installed in `node_modules`,
`location` can have any value.
`languages` must include `vue` even if it is listed in `filetypes`.
`filetypes` is extended here to include Vue SFC.
]],
default_config = {
root_dir = [[root_pattern("tsconfig.json", "package.json", "jsconfig.json", ".git")]],
Expand Down
7 changes: 6 additions & 1 deletion lua/lspconfig/server_configurations/volar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,14 @@ npm install -g @vue/language-server
Volar by default supports Vue 3 projects. Vue 2 projects need
[additional configuration](https://github.com/vuejs/language-tools/tree/master/packages/vscode-vue#usage).
**TypeScript support**
As of release 2.0.0, Volar no longer wraps around tsserver. For typescript
support, `tsserver` needs to be configured with the `@vue/typescript-plugin`
plugin.
**Take Over Mode**
Volar can serve as a language server for both Vue and TypeScript via [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471).
Volar (prior to 2.0.0), can serve as a language server for both Vue and TypeScript via [Take Over Mode](https://github.com/johnsoncodehk/volar/discussions/471).
To enable Take Over Mode, override the default filetypes in `setup{}` as follows:
Expand Down

0 comments on commit c535630

Please sign in to comment.