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>
This commit is contained in:
parent
1fce168881
commit
24027ed8d7
1 changed files with 11 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue