From 45c5095097702e8316f9409b39b2721db8534db2 Mon Sep 17 00:00:00 2001 From: dundargoc Date: Sat, 21 Dec 2024 14:08:47 +0100 Subject: refactor: deprecate util.path.join Work on https://github.com/neovim/nvim-lspconfig/issues/2079. --- lua/lspconfig/util.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'lua/lspconfig/util.lua') diff --git a/lua/lspconfig/util.lua b/lua/lspconfig/util.lua index 213e87f3..c1ad0128 100644 --- a/lua/lspconfig/util.lua +++ b/lua/lspconfig/util.lua @@ -107,10 +107,6 @@ M.path = (function() end end - local function path_join(...) - return table.concat(M.tbl_flatten { ... }, '/') - end - -- Traverse the path calling cb along the way. local function traverse_parents(path, cb) path = vim.loop.fs_realpath(path) @@ -165,7 +161,6 @@ M.path = (function() local path_separator = iswin and ';' or ':' return { - join = path_join, traverse_parents = traverse_parents, iterate_parents = iterate_parents, is_descendant = is_descendant, @@ -204,7 +199,7 @@ function M.root_pattern(...) startpath = M.strip_archive_subpath(startpath) for _, pattern in ipairs(patterns) do local match = M.search_ancestors(startpath, function(path) - for _, p in ipairs(vim.fn.glob(M.path.join(escape_wildcards(path), pattern), true, true)) do + for _, p in ipairs(vim.fn.glob(table.concat({ escape_wildcards(path), pattern }, '/'), true, true)) do if vim.loop.fs_stat(p) then return path end @@ -363,6 +358,11 @@ function M.path.exists(filename) return stat and stat.type or false end +--- @deprecated use `table.concat({"path1", "path2"})` or regular string concatenation instead +function M.path.join(...) + return table.concat({ ... }, '/') +end + --- @deprecated use `vim.fs.dirname(vim.fs.find('.hg', { path = startpath, upward = true })[1])` instead function M.find_mercurial_ancestor(startpath) return vim.fs.dirname(vim.fs.find('.hg', { path = startpath, upward = true })[1]) -- cgit v1.2.3-70-g09d2