aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lua/lspconfig/configs/fennel_ls.lua2
-rw-r--r--lua/lspconfig/configs/turtle_ls.lua2
-rw-r--r--lua/lspconfig/util.lua8
-rw-r--r--scripts/docgen.lua6
4 files changed, 9 insertions, 9 deletions
diff --git a/lua/lspconfig/configs/fennel_ls.lua b/lua/lspconfig/configs/fennel_ls.lua
index d1827cf4..273f1fed 100644
--- a/lua/lspconfig/configs/fennel_ls.lua
+++ b/lua/lspconfig/configs/fennel_ls.lua
@@ -7,7 +7,7 @@ return {
root_dir = function(dir)
local has_fls_project_cfg = function(path)
local fnlpath = vim.fs.joinpath(path, 'flsproject.fnl')
- return vim.fn.getftype(fnlpath) == 'file'
+ return (vim.loop.fs_stat(fnlpath) or {}).type == 'file'
end
return util.search_ancestors(dir, has_fls_project_cfg) or vim.fs.root(0, '.git')
end,
diff --git a/lua/lspconfig/configs/turtle_ls.lua b/lua/lspconfig/configs/turtle_ls.lua
index e9d985e2..220953fd 100644
--- a/lua/lspconfig/configs/turtle_ls.lua
+++ b/lua/lspconfig/configs/turtle_ls.lua
@@ -17,7 +17,7 @@ if bin_path == nil then
end
for _, p in ipairs(paths) do
local candidate = util.path.join(p, bin_name)
- if vim.fn.getftype(candidate) == 'file' then
+ if (vim.loop.fs_stat(candidate) or {}).type == 'file' then
full_path = candidate
break
end
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
diff --git a/scripts/docgen.lua b/scripts/docgen.lua
index faecbcda..02c04dc8 100644
--- a/scripts/docgen.lua
+++ b/scripts/docgen.lua
@@ -62,7 +62,7 @@ local function make_section(indentlvl, sep, parts)
end
local function readfile(path)
- assert(vim.fn.getftype(path) == 'file')
+ assert((vim.loop.fs_stat(path) or {}).type == 'file')
return io.open(path):read '*a'
end
@@ -180,10 +180,10 @@ local function make_lsp_sections()
function()
local package_json_name = util.path.join(tempdir, config_name .. '.package.json')
if docs.package_json then
- if vim.fn.getftype(package_json_name) ~= 'file' then
+ if not ((vim.loop.fs_stat(package_json_name) or {}).type == 'file') then
os.execute(string.format('curl -v -L -o %q %q', package_json_name, docs.package_json))
end
- if vim.fn.getftype(package_json_name) ~= 'file' then
+ if not ((vim.loop.fs_stat(package_json_name) or {}).type == 'file') then
print(string.format('Failed to download package.json for %q at %q', config_name, docs.package_json))
os.exit(1)
return