refactor: Neovim 0.11 won't need the glob ordering hack
This commit is contained in:
parent
96368e13e9
commit
a62ec258d1
1 changed files with 8 additions and 6 deletions
|
|
@ -77,13 +77,15 @@ local function get_matching_paths(client, filters, paths)
|
||||||
if vim.glob and vim.glob.to_lpeg then
|
if vim.glob and vim.glob.to_lpeg then
|
||||||
-- HACK around https://github.com/neovim/neovim/issues/28931
|
-- HACK around https://github.com/neovim/neovim/issues/28931
|
||||||
-- find alternations and sort them by length to try to match the longest first
|
-- find alternations and sort them by length to try to match the longest first
|
||||||
glob = glob:gsub("{(.*)}", function(s)
|
if vim.has("nvim-0.11") == 0 then
|
||||||
local pieces = vim.split(s, ",")
|
glob = glob:gsub("{(.*)}", function(s)
|
||||||
table.sort(pieces, function(a, b)
|
local pieces = vim.split(s, ",")
|
||||||
return a:len() > b:len()
|
table.sort(pieces, function(a, b)
|
||||||
|
return a:len() > b:len()
|
||||||
|
end)
|
||||||
|
return "{" .. table.concat(pieces, ",") .. "}"
|
||||||
end)
|
end)
|
||||||
return "{" .. table.concat(pieces, ",") .. "}"
|
end
|
||||||
end)
|
|
||||||
|
|
||||||
glob_to_match = vim.glob.to_lpeg(glob)
|
glob_to_match = vim.glob.to_lpeg(glob)
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue