diff options
| author | Hugo <hugo@whynothugo.nl> | 2024-03-05 07:13:18 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-03-05 14:13:18 +0800 |
| commit | c9f387fab1d09ed59d877a08a05d283195df95e7 (patch) | |
| tree | 0a1a0ccd5d05bd3f86c69258f77a1d0150845880 /lua | |
| parent | fix: update lua types to match latest nightly (#3048) (diff) | |
| download | nvim-lspconfig-c9f387fab1d09ed59d877a08a05d283195df95e7.tar nvim-lspconfig-c9f387fab1d09ed59d877a08a05d283195df95e7.tar.gz nvim-lspconfig-c9f387fab1d09ed59d877a08a05d283195df95e7.tar.bz2 nvim-lspconfig-c9f387fab1d09ed59d877a08a05d283195df95e7.tar.lz nvim-lspconfig-c9f387fab1d09ed59d877a08a05d283195df95e7.tar.xz nvim-lspconfig-c9f387fab1d09ed59d877a08a05d283195df95e7.tar.zst nvim-lspconfig-c9f387fab1d09ed59d877a08a05d283195df95e7.zip | |
docs: update documentation for Volar >= 2.0.0 (#3049)
See: https://github.com/vuejs/language-tools/issues/3925
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/lspconfig/server_configurations/tsserver.lua | 31 | ||||
| -rw-r--r-- | lua/lspconfig/server_configurations/volar.lua | 7 |
2 files changed, 37 insertions, 1 deletions
diff --git a/lua/lspconfig/server_configurations/tsserver.lua b/lua/lspconfig/server_configurations/tsserver.lua index 735889b3..347b15d7 100644 --- a/lua/lspconfig/server_configurations/tsserver.lua +++ b/lua/lspconfig/server_configurations/tsserver.lua @@ -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")]], diff --git a/lua/lspconfig/server_configurations/volar.lua b/lua/lspconfig/server_configurations/volar.lua index 30c7ec70..4875b1ff 100644 --- a/lua/lspconfig/server_configurations/volar.lua +++ b/lua/lspconfig/server_configurations/volar.lua @@ -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: |
