From 4761665b4be82c46612cdfb4ea9c90de25875c4f Mon Sep 17 00:00:00 2001 From: Jacob Reed Date: Fri, 13 Dec 2024 14:30:45 -0500 Subject: fix(regression): fix for vim.fs.find regression not returning parent directory (#3505) --- lua/lspconfig/util.lua | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'lua/lspconfig/util.lua') diff --git a/lua/lspconfig/util.lua b/lua/lspconfig/util.lua index a5cf67fd..cc97867f 100644 --- a/lua/lspconfig/util.lua +++ b/lua/lspconfig/util.lua @@ -248,7 +248,7 @@ end function M.insert_package_json(config_files, field, fname) local path = vim.fn.fnamemodify(fname, ':h') - local root_with_package = vim.fs.find('package.json', { path = path, upward = true })[1] + local root_with_package = vim.fs.dirname(vim.fs.find('package.json', { path = path, upward = true })[1]) if root_with_package then -- only add package.json if it contains field parameter @@ -380,17 +380,17 @@ end --- @deprecated use `vim.fs.find('.hg', { path = startpath, upward = true })[1]` instead function M.find_mercurial_ancestor(startpath) - return vim.fs.find('.hg', { path = startpath, upward = true })[1] + return vim.fs.dirname(vim.fs.find('.hg', { path = startpath, upward = true })[1]) end --- @deprecated use `vim.fs.find('node_modules', { path = startpath, upward = true })[1]` instead function M.find_node_modules_ancestor(startpath) - return vim.fs.find('node_modules', { path = startpath, upward = true })[1] + return vim.fs.dirname(vim.fs.find('node_modules', { path = startpath, upward = true })[1]) end --- @deprecated use `vim.fs.find('package.json', { path = startpath, upward = true })[1]` instead function M.find_package_json_ancestor(startpath) - return vim.fs.find('package.json', { path = startpath, upward = true })[1] + return vim.fs.dirname(vim.fs.find('package.json', { path = startpath, upward = true })[1]) end return M -- cgit v1.2.3-70-g09d2