Skip to content

Commit

Permalink
refactor: Neovim 0.11 won't need the glob ordering hack
Browse files Browse the repository at this point in the history
  • Loading branch information
stevearc committed Jun 10, 2024
1 parent 96368e1 commit a62ec25
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions lua/oil/lsp/workspace.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,13 +77,15 @@ local function get_matching_paths(client, filters, paths)
if vim.glob and vim.glob.to_lpeg then
-- HACK around https://github.com/neovim/neovim/issues/28931
-- find alternations and sort them by length to try to match the longest first
glob = glob:gsub("{(.*)}", function(s)
local pieces = vim.split(s, ",")
table.sort(pieces, function(a, b)
return a:len() > b:len()
if vim.has("nvim-0.11") == 0 then
glob = glob:gsub("{(.*)}", function(s)
local pieces = vim.split(s, ",")
table.sort(pieces, function(a, b)
return a:len() > b:len()
end)
return "{" .. table.concat(pieces, ",") .. "}"
end)
return "{" .. table.concat(pieces, ",") .. "}"
end)
end

glob_to_match = vim.glob.to_lpeg(glob)
end
Expand Down

0 comments on commit a62ec25

Please sign in to comment.