diff options
| author | dundargoc <gocdundar@gmail.com> | 2024-12-13 14:53:08 +0100 |
|---|---|---|
| committer | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2024-12-14 17:24:12 +0100 |
| commit | 12d163c5c2b05e85431f2deef5d9d59a8fd8dfc2 (patch) | |
| tree | 0bfbfbd378ba61cde77f9132b6d0c3570805eb88 /lua/lspconfig/util.lua | |
| parent | docs: how to get package.json parent dir #3506 (diff) | |
| download | nvim-lspconfig-12d163c5c2b05e85431f2deef5d9d59a8fd8dfc2.tar nvim-lspconfig-12d163c5c2b05e85431f2deef5d9d59a8fd8dfc2.tar.gz nvim-lspconfig-12d163c5c2b05e85431f2deef5d9d59a8fd8dfc2.tar.bz2 nvim-lspconfig-12d163c5c2b05e85431f2deef5d9d59a8fd8dfc2.tar.lz nvim-lspconfig-12d163c5c2b05e85431f2deef5d9d59a8fd8dfc2.tar.xz nvim-lspconfig-12d163c5c2b05e85431f2deef5d9d59a8fd8dfc2.tar.zst nvim-lspconfig-12d163c5c2b05e85431f2deef5d9d59a8fd8dfc2.zip | |
refactor: deprecate util.find_git_ancestor
Work on https://github.com/neovim/nvim-lspconfig/issues/2079.
Diffstat (limited to 'lua/lspconfig/util.lua')
| -rw-r--r-- | lua/lspconfig/util.lua | 15 |
1 files changed, 5 insertions, 10 deletions
diff --git a/lua/lspconfig/util.lua b/lua/lspconfig/util.lua index 4bd82b5b..9b888efe 100644 --- a/lua/lspconfig/util.lua +++ b/lua/lspconfig/util.lua @@ -236,16 +236,6 @@ function M.root_pattern(...) end end -function M.find_git_ancestor(startpath) - return M.search_ancestors(startpath, function(path) - -- Support git directories and git files (worktrees) - local gitpath = M.path.join(path, '.git') - if vim.fn.isdirectory(gitpath) == 1 or (vim.loop.fs_stat(gitpath) or {}).type == 'file' then - return path - end - end) -end - function M.insert_package_json(config_files, field, fname) local path = vim.fn.fnamemodify(fname, ':h') local root_with_package = vim.fs.dirname(vim.fs.find('package.json', { path = path, upward = true })[1]) @@ -393,4 +383,9 @@ function M.find_package_json_ancestor(startpath) return vim.fs.dirname(vim.fs.find('package.json', { path = startpath, upward = true })[1]) end +--- @deprecated use `vim.fs.dirname(vim.fs.find('.git', { path = startpath, upward = true })[1])` instead +function M.find_git_ancestor(startpath) + return vim.fs.dirname(vim.fs.find('.git', { path = startpath, upward = true })[1]) +end + return M |
