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

@ -290,8 +290,8 @@ local M = {}
---@class (exact) oil.ViewOptions
---@field show_hidden boolean
---@field is_hidden_file fun(name: string, bufnr: integer): boolean
---@field is_always_hidden fun(name: string, bufnr: integer): boolean
---@field is_hidden_file fun(name: string, bufnr: integer, entry: oil.Entry): boolean
---@field is_always_hidden fun(name: string, bufnr: integer, entry: oil.Entry): boolean
---@field natural_order boolean|"fast"
---@field case_insensitive boolean
---@field sort oil.SortSpec[]