aboutsummaryrefslogtreecommitdiffstats
path: root/lua
diff options
context:
space:
mode:
authordundargoc <gocdundar@gmail.com>2024-12-14 15:52:13 +0100
committerdundargoc <33953936+dundargoc@users.noreply.github.com>2024-12-14 21:51:16 +0100
commit3da18150795cd0cf2c0efe3c6fe6e142800c14ef (patch)
tree02c054b212c81d18813cb6c9821f2a7c9dea9c63 /lua
parentdocs: update configs.md (diff)
downloadnvim-lspconfig-3da18150795cd0cf2c0efe3c6fe6e142800c14ef.tar
nvim-lspconfig-3da18150795cd0cf2c0efe3c6fe6e142800c14ef.tar.gz
nvim-lspconfig-3da18150795cd0cf2c0efe3c6fe6e142800c14ef.tar.bz2
nvim-lspconfig-3da18150795cd0cf2c0efe3c6fe6e142800c14ef.tar.lz
nvim-lspconfig-3da18150795cd0cf2c0efe3c6fe6e142800c14ef.tar.xz
nvim-lspconfig-3da18150795cd0cf2c0efe3c6fe6e142800c14ef.tar.zst
nvim-lspconfig-3da18150795cd0cf2c0efe3c6fe6e142800c14ef.zip
refactor!: remove util.path.escape_wildcards
Work on https://github.com/neovim/nvim-lspconfig/issues/2079.
Diffstat (limited to 'lua')
-rw-r--r--lua/lspconfig/util.lua11
1 files changed, 5 insertions, 6 deletions
diff --git a/lua/lspconfig/util.lua b/lua/lspconfig/util.lua
index 9b888efe..dd84f4f8 100644
--- a/lua/lspconfig/util.lua
+++ b/lua/lspconfig/util.lua
@@ -97,10 +97,6 @@ end
-- Some path utilities
M.path = (function()
- local function escape_wildcards(path)
- return path:gsub('([%[%]%?%*])', '\\%1')
- end
-
--- @param path string
--- @return boolean
local function is_fs_root(path)
@@ -179,7 +175,6 @@ M.path = (function()
local path_separator = iswin and ';' or ':'
return {
- escape_wildcards = escape_wildcards,
is_absolute = is_absolute,
join = path_join,
traverse_parents = traverse_parents,
@@ -216,13 +211,17 @@ function M.get_lsp_clients(filter)
return nvim_eleven and lsp.get_clients(filter) or lsp.get_active_clients(filter)
end
+local function escape_wildcards(path)
+ return path:gsub('([%[%]%?%*])', '\\%1')
+end
+
function M.root_pattern(...)
local patterns = M.tbl_flatten { ... }
return function(startpath)
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(M.path.escape_wildcards(path), pattern), true, true)) do
+ for _, p in ipairs(vim.fn.glob(M.path.join(escape_wildcards(path), pattern), true, true)) do
if vim.loop.fs_stat(p) then
return path
end