feat: pass entry to is_hidden_file and is_always_hidden callbacks

Problem: the is_hidden_file and is_always_hidden config callbacks
only received (name, bufnr), making it impossible to filter by entry
type, permissions, or other metadata without reimplementing entry
lookup.

Solution: pass the full oil.Entry as a third argument to both
callbacks. Existing configs that only accept (name, bufnr) are
unaffected since Lua silently ignores extra arguments. The internal
should_display function signature changes from (name, bufnr) to
(bufnr, entry) to reflect its new contract.

Cherry-picked from: stevearc/oil.nvim#644
This commit is contained in:
Barrett Ruth 2026-02-20 16:29:08 -05:00
parent 16f3d7bfa9
commit 4ab4765a84
4 changed files with 15 additions and 12 deletions

View file

@ -129,7 +129,7 @@ M.set_sort = function(sort)
end
---Change how oil determines if the file is hidden
---@param is_hidden_file fun(filename: string, bufnr: integer): boolean Return true if the file/dir should be hidden
---@param is_hidden_file fun(filename: string, bufnr: integer, entry: oil.Entry): boolean Return true if the file/dir should be hidden
M.set_is_hidden_file = function(is_hidden_file)
require("oil.view").set_is_hidden_file(is_hidden_file)
end