aboutsummaryrefslogtreecommitdiffstats
path: root/lsp/volar.lua
diff options
context:
space:
mode:
authorAlexis Tacnet <alexistacnet@gmail.com>2025-04-28 14:11:00 +0200
committerGitHub <noreply@github.com>2025-04-28 05:11:00 -0700
commit9c6bbb5d1125491c7c7547e15188ae3e42647143 (patch)
treea1cbe79cc352595db07c188a577802e5aaab3630 /lsp/volar.lua
parentci: check legacy configs *last* #3797 (diff)
downloadnvim-lspconfig-9c6bbb5d1125491c7c7547e15188ae3e42647143.tar
nvim-lspconfig-9c6bbb5d1125491c7c7547e15188ae3e42647143.tar.gz
nvim-lspconfig-9c6bbb5d1125491c7c7547e15188ae3e42647143.tar.bz2
nvim-lspconfig-9c6bbb5d1125491c7c7547e15188ae3e42647143.tar.lz
nvim-lspconfig-9c6bbb5d1125491c7c7547e15188ae3e42647143.tar.xz
nvim-lspconfig-9c6bbb5d1125491c7c7547e15188ae3e42647143.tar.zst
nvim-lspconfig-9c6bbb5d1125491c7c7547e15188ae3e42647143.zip
fix: improve typescript server path search for ts-dependent lsp #3795
Diffstat (limited to 'lsp/volar.lua')
-rw-r--r--lsp/volar.lua7
1 files changed, 2 insertions, 5 deletions
diff --git a/lsp/volar.lua b/lsp/volar.lua
index 50b9a326..bd8006cc 100644
--- a/lsp/volar.lua
+++ b/lsp/volar.lua
@@ -73,10 +73,7 @@
--- })
--- ```
-local function get_typescript_server_path(root_dir)
- local project_root = vim.fs.dirname(vim.fs.find('node_modules', { path = root_dir, upward = true })[1])
- return project_root and vim.fs.joinpath(project_root, 'node_modules', 'typescript', 'lib') or ''
-end
+local util = require 'lspconfig.util'
-- https://github.com/vuejs/language-tools/blob/master/packages/language-server/lib/types.ts
local volar_init_options = {
@@ -92,7 +89,7 @@ return {
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 = get_typescript_server_path(config.root_dir)
+ config.init_options.typescript.tsdk = util.get_typescript_server_path(config.root_dir)
end
end,
}