aboutsummaryrefslogtreecommitdiffstats
path: root/lua/lspconfig/util.lua
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2024-12-06 03:19:39 -0800
committerGitHub <noreply@github.com>2024-12-06 03:19:39 -0800
commit64073cbed0ce23e988160bfd1a148a75b6af94cc (patch)
treee0fe72bb119de8903bd716f6bc510c2e1d4c11f7 /lua/lspconfig/util.lua
parentfix(typst_lsp): deprecate typst_lsp to tinymist (#3493) (diff)
downloadnvim-lspconfig-64073cbed0ce23e988160bfd1a148a75b6af94cc.tar
nvim-lspconfig-64073cbed0ce23e988160bfd1a148a75b6af94cc.tar.gz
nvim-lspconfig-64073cbed0ce23e988160bfd1a148a75b6af94cc.tar.bz2
nvim-lspconfig-64073cbed0ce23e988160bfd1a148a75b6af94cc.tar.lz
nvim-lspconfig-64073cbed0ce23e988160bfd1a148a75b6af94cc.tar.xz
nvim-lspconfig-64073cbed0ce23e988160bfd1a148a75b6af94cc.tar.zst
nvim-lspconfig-64073cbed0ce23e988160bfd1a148a75b6af94cc.zip
Revert "refactor: use simpler file existence check" #3495
This reverts commit 90c1c6cc822b1836209514c096069b9bbeab63d9. Fix #3485
Diffstat (limited to 'lua/lspconfig/util.lua')
-rw-r--r--lua/lspconfig/util.lua8
1 files changed, 4 insertions, 4 deletions
diff --git a/lua/lspconfig/util.lua b/lua/lspconfig/util.lua
index dbd3e789..1b186e85 100644
--- a/lua/lspconfig/util.lua
+++ b/lua/lspconfig/util.lua
@@ -240,7 +240,7 @@ 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.fn.getftype(gitpath) == 'file') then
+ if vim.fn.isdirectory(gitpath) == 1 or (vim.loop.fs_stat(gitpath) or {}).type == 'file' then
return path
end
end)
@@ -257,7 +257,7 @@ end
function M.find_package_json_ancestor(startpath)
return M.search_ancestors(startpath, function(path)
local jsonpath = M.path.join(path, 'package.json')
- if vim.fn.getftype(jsonpath) == 'file' then
+ if (vim.loop.fs_stat(jsonpath) or {}).type == 'file' then
return path
end
end)
@@ -374,11 +374,11 @@ function M.path.is_dir(filename)
return vim.fn.isdirectory(filename) == 1
end
---- @deprecated use `vim.fn.getftype(path) == 'file'` instead
+--- @deprecated use `(vim.loop.fs_stat(path) or {}).type == 'file'` instead
--- @param path string
--- @return boolean
function M.path.is_file(path)
- return vim.fn.getftype(path) == 'file'
+ return (vim.loop.fs_stat(path) or {}).type == 'file'
end
--- @deprecated use `vim.fs.dirname` instead