-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: deprecate util.find_git_ancestor #3507
Conversation
b60bbb3
to
1b2444c
Compare
lua/lspconfig/util.lua
Outdated
@@ -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.find('.git', { path = startpath, upward = true })[1]` instead | |||
function M.find_git_ancestor(startpath) | |||
return vim.fs.find('.git', { path = startpath, upward = true })[1] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use vim.fs.dirname
to get parent dir of result { "/Users/mw/workspace/neovim/.git" }
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Considering this is a very common situation, maybe it is better to add parent = true to the filter table
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean we add parent
as an option to vim.fs.find
? But we already have vim.fs.root
that does what we want, we just can't use it right now since we support 0.9. Eventually we can drop that and start using vim.fs.root
, and won't need to adjust vim.fs.find
.
12f3c41
to
3d488da
Compare
3d488da
to
4d4de10
Compare
Work on #2079.