diff options
| author | Alexis Tacnet <alexistacnet@gmail.com> | 2025-04-28 14:11:00 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-04-28 05:11:00 -0700 |
| commit | 9c6bbb5d1125491c7c7547e15188ae3e42647143 (patch) | |
| tree | a1cbe79cc352595db07c188a577802e5aaab3630 /lsp/astro.lua | |
| parent | ci: check legacy configs *last* #3797 (diff) | |
| download | nvim-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/astro.lua')
| -rw-r--r-- | lsp/astro.lua | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lsp/astro.lua b/lsp/astro.lua index 2bd64310..6f33439c 100644 --- a/lsp/astro.lua +++ b/lsp/astro.lua @@ -7,10 +7,7 @@ --- npm install -g @astrojs/language-server --- ``` -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' return { cmd = { 'astro-ls', '--stdio' }, @@ -21,7 +18,7 @@ return { }, before_init = function(_, config) if config.init_options and config.init_options.typescript and not 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, } |
