aboutsummaryrefslogtreecommitdiffstats
path: root/lsp/volar.lua
diff options
context:
space:
mode:
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,
}