From 24027ed8d7f3ee5c38cfd713915e2e16d89e79b3 Mon Sep 17 00:00:00 2001 From: Luckas Date: Sun, 10 Dec 2023 22:41:12 +0300 Subject: [PATCH] fix: willRename source path (#248) * fix: willRename source path * update: path matching handling * lint: apply stylua --------- Co-authored-by: Steven Arcangeli <506791+stevearc@users.noreply.github.com> --- lua/oil/lsp_helpers.lua | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/lua/oil/lsp_helpers.lua b/lua/oil/lsp_helpers.lua index e6a8d2d9..70b0f2cc 100644 --- a/lua/oil/lsp_helpers.lua +++ b/lua/oil/lsp_helpers.lua @@ -13,6 +13,16 @@ local function file_matches(filepath, pattern) return false end end + + if vim.lsp._watchfiles then + local glob = pattern.glob + local path = filepath + if vim.tbl_get(pattern, "options", "ignoreCase") then + glob, path = glob:lower(), path:lower() + end + return vim.lsp._watchfiles._match(glob, path) + end + local pat = vim.fn.glob2regpat(pattern.glob) if vim.tbl_get(pattern, "options", "ignoreCase") then pat = "\\c" .. pat @@ -49,7 +59,7 @@ local function get_matching_paths(client, path_pairs) for _, pair in ipairs(path_pairs) do if fs.is_subpath(client.config.root_dir, pair.src) then local relative_file = pair.src:sub(client.config.root_dir:len() + 2) - if any_match(relative_file, filters) then + if any_match(pair.src, filters) or any_match(relative_file, filters) then table.insert(ret, pair) end end