Skip to content

Commit

Permalink
refactor: deprecate util.find_mercurial_ancestor
Browse files Browse the repository at this point in the history
Work on #2079.
  • Loading branch information
dundargoc committed Nov 29, 2024
1 parent 6a5ed22 commit e869c7e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion .github/ci/run_sanitizer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ if git diff --pickaxe-all -U0 -G "${SEARCH_PATTERN}" "${REF_BRANCH}" "${PR_BRANC
exit 1
fi

SEARCH_PATTERN='(util\.path\.dirname|util\.path\.sanitize|util\.path\.exists|util\.path\.is_file|util\.path\.is_dir)'
SEARCH_PATTERN='(util\.path\.dirname|util\.path\.sanitize|util\.path\.exists|util\.path\.is_file|util\.path\.is_dir|util\.find_mercurial_ancestor)'

if git diff --pickaxe-all -U0 -G "${SEARCH_PATTERN}" "${REF_BRANCH}" "${PR_BRANCH}" -- '*.lua' | grep -Ev '\.lua$' | grep -E "^\+.*${SEARCH_PATTERN}" ; then
echo
Expand Down
14 changes: 5 additions & 9 deletions lua/lspconfig/util.lua
Original file line number Diff line number Diff line change
Expand Up @@ -247,15 +247,6 @@ function M.find_git_ancestor(startpath)
end)
end

function M.find_mercurial_ancestor(startpath)
return M.search_ancestors(startpath, function(path)
-- Support Mercurial directories
if vim.fn.isdirectory(M.path.join(path, '.hg')) == 1 then
return path
end
end)
end

function M.find_node_modules_ancestor(startpath)
return M.search_ancestors(startpath, function(path)
if vim.fn.isdirectory(M.path.join(path, 'node_modules')) == 1 then
Expand Down Expand Up @@ -405,4 +396,9 @@ function M.path.exists(filename)
return stat and stat.type or false
end

--- @deprecated use `vim.fs.find('.hg', { path = startpath, upward = true })` instead
function M.find_mercurial_ancestor(startpath)
return vim.fs.find('.hg', { path = startpath, upward = true })
end

return M

0 comments on commit e869c7e

Please sign in to comment.