aboutsummaryrefslogtreecommitdiffstats
path: root/lsp
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2025-05-21 06:31:55 -0700
committerGitHub <noreply@github.com>2025-05-21 06:31:55 -0700
commit2864899443afddcd9dd05b14ea2f835218a7bed3 (patch)
treed5319bb88cc61e94fd02a298c8219ad70b3714a1 /lsp
parentfix(gopls): prioritise `go.work` over `go.mod` (diff)
parentchore(vuels): remove config (diff)
downloadnvim-lspconfig-2864899443afddcd9dd05b14ea2f835218a7bed3.tar
nvim-lspconfig-2864899443afddcd9dd05b14ea2f835218a7bed3.tar.gz
nvim-lspconfig-2864899443afddcd9dd05b14ea2f835218a7bed3.tar.bz2
nvim-lspconfig-2864899443afddcd9dd05b14ea2f835218a7bed3.tar.lz
nvim-lspconfig-2864899443afddcd9dd05b14ea2f835218a7bed3.tar.xz
nvim-lspconfig-2864899443afddcd9dd05b14ea2f835218a7bed3.tar.zst
nvim-lspconfig-2864899443afddcd9dd05b14ea2f835218a7bed3.zip
Merge #3843 from Jak-Ch-ll/rename-volar
Rename `volar` to `vue_ls` and remove `vuels`
Diffstat (limited to 'lsp')
-rw-r--r--lsp/ts_ls.lua10
-rw-r--r--lsp/volar.lua93
-rw-r--r--lsp/vue_ls.lua91
-rw-r--r--lsp/vuels.lua52
4 files changed, 99 insertions, 147 deletions
diff --git a/lsp/ts_ls.lua b/lsp/ts_ls.lua
index 877a663c..360a805b 100644
--- a/lsp/ts_ls.lua
+++ b/lsp/ts_ls.lua
@@ -35,10 +35,10 @@
---
--- ### Vue support
---
---- As of 2.0.0, Volar no longer supports TypeScript itself. Instead, a plugin
+--- As of 2.0.0, the Vue language server no longer supports TypeScript itself. Instead, a plugin
--- adds Vue support to this language server.
---
---- *IMPORTANT*: It is crucial to ensure that `@vue/typescript-plugin` and `volar `are of identical versions.
+--- *IMPORTANT*: It is crucial to ensure that `@vue/typescript-plugin` and `@vue/language-server `are of identical versions.
---
--- ```lua
--- vim.lsp.config('ts_ls', {
@@ -58,9 +58,9 @@
--- },
--- })
---
---- -- You must make sure volar is setup
---- -- e.g. vim.lsp.config('volar')
---- -- See volar's section for more information
+--- -- You must make sure the Vue language server is setup
+--- -- e.g. vim.lsp.config('vue_ls')
+--- -- See vue_ls's section for more information
--- ```
---
--- `location` MUST be defined. If the plugin is installed in `node_modules`,
diff --git a/lsp/volar.lua b/lsp/volar.lua
index bd8006cc..bfa4bc9a 100644
--- a/lsp/volar.lua
+++ b/lsp/volar.lua
@@ -1,95 +1,8 @@
---@brief
---
---- https://github.com/vuejs/language-tools/tree/master/packages/language-server
+--- Renamed to [vue_ls](#vue_ls)
---
---- Volar language server for Vue
---
---- Volar can be installed via npm:
---- ```sh
---- npm install -g @vue/language-server
---- ```
----
---- Volar by default supports Vue 3 projects.
---- For Vue 2 projects, [additional configuration](https://github.com/vuejs/language-tools/blob/master/extensions/vscode/README.md?plain=1#L19) are required.
----
---- **Hybrid Mode (by default)**
----
---- In this mode, the Vue Language Server exclusively manages the CSS/HTML sections.
---- You need the `ts_ls` server with the `@vue/typescript-plugin` plugin to support TypeScript in `.vue` files.
---- See `ts_ls` section for more information
----
---- **No Hybrid Mode**
----
---- Volar will run embedded `ts_ls` therefore there is no need to run it separately.
---- ```lua
---- local lspconfig = require('lspconfig')
----
---- vim.lsp.config('volar', {
---- -- add filetypes for typescript, javascript and vue
---- filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
---- init_options = {
---- vue = {
---- -- disable hybrid mode
---- hybridMode = false,
---- },
---- },
---- })
---- -- you must remove "ts_ls" config
---- -- vim.lsp.config['ts_ls'] = {}
---- ```
----
---- **Overriding the default TypeScript Server used by Volar**
----
---- The default config looks for TypeScript in the local `node_modules`. This can lead to issues
---- e.g. when working on a [monorepo](https://monorepo.tools/). The alternatives are:
----
---- - use a global TypeScript Server installation
---- ```lua
---- vim.lsp.config('volar', {
---- init_options = {
---- typescript = {
---- -- replace with your global TypeScript library path
---- tsdk = '/path/to/node_modules/typescript/lib'
---- }
---- }
---- })
---- ```
----
---- - use a local server and fall back to a global TypeScript Server installation
---- ```lua
---- vim.lsp.config('volar', {
---- init_options = {
---- typescript = {
---- -- replace with your global TypeScript library path
---- tsdk = '/path/to/node_modules/typescript/lib'
---- }
---- },
---- before_init = function(params, config)
---- local lib_path = vim.fs.find('node_modules/typescript/lib', { path = new_root_dir, upward = true })[1]
---- if lib_path then
---- config.init_options.typescript.tsdk = lib_path
---- end
---- end
---- })
---- ```
-
-local util = require 'lspconfig.util'
-
--- https://github.com/vuejs/language-tools/blob/master/packages/language-server/lib/types.ts
-local volar_init_options = {
- typescript = {
- tsdk = '',
- },
-}
+vim.deprecate('volar', 'vue_ls', '3.0.0', 'lspconfig', false)
-return {
- cmd = { 'vue-language-server', '--stdio' },
- filetypes = { 'vue' },
- root_markers = { 'package.json' },
- init_options = volar_init_options,
- before_init = function(_, config)
- if config.init_options and config.init_options.typescript and config.init_options.typescript.tsdk == '' then
- config.init_options.typescript.tsdk = util.get_typescript_server_path(config.root_dir)
- end
- end,
-}
+return vim.lsp.config.vue_ls
diff --git a/lsp/vue_ls.lua b/lsp/vue_ls.lua
new file mode 100644
index 00000000..457303a1
--- /dev/null
+++ b/lsp/vue_ls.lua
@@ -0,0 +1,91 @@
+---@brief
+---
+--- https://github.com/vuejs/language-tools/tree/master/packages/language-server
+---
+--- The official language server for Vue
+---
+--- It can be installed via npm:
+--- ```sh
+--- npm install -g @vue/language-server
+--- ```
+---
+--- The language server only supports Vue 3 projects by default.
+--- For Vue 2 projects, [additional configuration](https://github.com/vuejs/language-tools/blob/master/extensions/vscode/README.md?plain=1#L19) are required.
+---
+--- **Hybrid Mode (by default)**
+---
+--- In this mode, the Vue Language Server exclusively manages the CSS/HTML sections.
+--- You need the `ts_ls` server with the `@vue/typescript-plugin` plugin to support TypeScript in `.vue` files.
+--- See `ts_ls` section for more information
+---
+--- **No Hybrid Mode**
+---
+--- The Vue language server will run embedded `ts_ls` therefore there is no need to run it separately.
+--- ```lua
+--- vim.lsp.config('vue_ls', {
+--- -- add filetypes for typescript, javascript and vue
+--- filetypes = { 'typescript', 'javascript', 'javascriptreact', 'typescriptreact', 'vue' },
+--- init_options = {
+--- vue = {
+--- -- disable hybrid mode
+--- hybridMode = false,
+--- },
+--- },
+--- })
+--- -- you must remove "ts_ls" config
+--- -- vim.lsp.config['ts_ls'] = {}
+--- ```
+---
+--- **Overriding the default TypeScript Server used by the Vue language server**
+---
+--- The default config looks for TypeScript in the local `node_modules`. This can lead to issues
+--- e.g. when working on a [monorepo](https://monorepo.tools/). The alternatives are:
+---
+--- - use a global TypeScript Server installation
+--- ```lua
+--- vim.lsp.config('vue_ls', {
+--- init_options = {
+--- typescript = {
+--- -- replace with your global TypeScript library path
+--- tsdk = '/path/to/node_modules/typescript/lib'
+--- }
+--- }
+--- })
+--- ```
+---
+--- - use a local server and fall back to a global TypeScript Server installation
+--- ```lua
+--- vim.lsp.config('vue_ls', {
+--- init_options = {
+--- typescript = {
+--- -- replace with your global TypeScript library path
+--- tsdk = '/path/to/node_modules/typescript/lib'
+--- }
+--- },
+--- before_init = function(params, config)
+--- local lib_path = vim.fs.find('node_modules/typescript/lib', { path = new_root_dir, upward = true })[1]
+--- if lib_path then
+--- config.init_options.typescript.tsdk = lib_path
+--- end
+--- end
+--- })
+--- ```
+
+local util = require 'lspconfig.util'
+
+return {
+ cmd = { 'vue-language-server', '--stdio' },
+ filetypes = { 'vue' },
+ root_markers = { 'package.json' },
+ -- https://github.com/vuejs/language-tools/blob/v2/packages/language-server/lib/types.ts
+ init_options = {
+ typescript = {
+ tsdk = '',
+ },
+ },
+ before_init = function(_, config)
+ if config.init_options and config.init_options.typescript and config.init_options.typescript.tsdk == '' then
+ config.init_options.typescript.tsdk = util.get_typescript_server_path(config.root_dir)
+ end
+ end,
+}
diff --git a/lsp/vuels.lua b/lsp/vuels.lua
deleted file mode 100644
index 9ac20991..00000000
--- a/lsp/vuels.lua
+++ /dev/null
@@ -1,52 +0,0 @@
----@brief
----
---- https://github.com/vuejs/vetur/tree/master/server
----
---- Vue language server(vls)
---- `vue-language-server` can be installed via `npm`:
---- ```sh
---- npm install -g vls
---- ```
-return {
- cmd = { 'vls' },
- filetypes = { 'vue' },
- root_markers = { 'package.json', 'vue.config.js' },
- init_options = {
- config = {
- vetur = {
- useWorkspaceDependencies = false,
- validation = {
- template = true,
- style = true,
- script = true,
- },
- completion = {
- autoImport = false,
- useScaffoldSnippets = false,
- tagCasing = 'kebab',
- },
- format = {
- defaultFormatter = {
- js = 'none',
- ts = 'none',
- },
- defaultFormatterOptions = {},
- scriptInitialIndent = false,
- styleInitialIndent = false,
- },
- },
- css = {},
- html = {
- suggest = {},
- },
- javascript = {
- format = {},
- },
- typescript = {
- format = {},
- },
- emmet = {},
- stylusSupremacy = {},
- },
- },
-}