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 /lua/lspconfig/util.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 'lua/lspconfig/util.lua')
| -rw-r--r-- | lua/lspconfig/util.lua | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lua/lspconfig/util.lua b/lua/lspconfig/util.lua index a8cf7439..2807edf3 100644 --- a/lua/lspconfig/util.lua +++ b/lua/lspconfig/util.lua @@ -69,6 +69,18 @@ function M.strip_archive_subpath(path) return path end +function M.get_typescript_server_path(root_dir) + local project_roots = vim.fs.find('node_modules', { path = root_dir, upward = true, limit = math.huge }) + for _, project_root in ipairs(project_roots) do + local typescript_path = project_root .. '/typescript' + local stat = vim.loop.fs_stat(typescript_path) + if stat and stat.type == 'directory' then + return typescript_path .. '/lib' + end + end + return '' +end + --- --- --- |
