@@ -76,17 +76,26 @@ local function get_matching_paths(client, filters, paths)
7676 --- @type string | vim.lpeg.Pattern
7777 local glob_to_match = glob
7878 if vim .glob and vim .glob .to_lpeg then
79- -- HACK around https://github.com/neovim/neovim/issues/28931
80- -- find alternations and sort them by length to try to match the longest first
81- if vim .fn .has (" nvim-0.11" ) == 0 then
82- glob = glob :gsub (" {(.*)}" , function (s )
83- local pieces = vim .split (s , " ," )
84- table.sort (pieces , function (a , b )
79+ glob = glob :gsub (" {(.-)}" , function (s )
80+ local patterns = vim .split (s , " ," )
81+ local filtered = {}
82+ for _ , pat in ipairs (patterns ) do
83+ if pat ~= " " then
84+ table.insert (filtered , pat )
85+ end
86+ end
87+ if # filtered == 0 then
88+ return " "
89+ end
90+ -- HACK around https://github.com/neovim/neovim/issues/28931
91+ -- find alternations and sort them by length to try to match the longest first
92+ if vim .fn .has (" nvim-0.11" ) == 0 then
93+ table.sort (filtered , function (a , b )
8594 return a :len () > b :len ()
8695 end )
87- return " { " .. table.concat ( pieces , " , " ) .. " } "
88- end )
89- end
96+ end
97+ return " { " .. table.concat ( filtered , " , " ) .. " } "
98+ end )
9099
91100 glob_to_match = vim .glob .to_lpeg (glob )
92101 end
0 commit comments