Skip to content

Commit

Permalink
fix: willRename source path (#248)
Browse files Browse the repository at this point in the history
* fix: willRename source path

* update: path matching handling

* lint: apply stylua

---------

Co-authored-by: Steven Arcangeli <506791+stevearc@users.noreply.github.com>
  • Loading branch information
luckasRanarison and stevearc authored Dec 10, 2023
1 parent 1fce168 commit 24027ed
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion lua/oil/lsp_helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 24027ed

Please sign in to comment.