Skip to content

Commit fe5f2a2

Browse files
committed
fix(files): handle hide_by_name and never_show options correctly, fixes #194
1 parent 50461b6 commit fe5f2a2

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

lua/neo-tree/sources/common/file-items.lua

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,13 @@ function create_item(context, path, _type)
7171
local f = state.filtered_items
7272
local is_not_root = not utils.is_subpath(path, context.state.path)
7373
if f and is_not_root then
74-
if f.hide_by_name[name] then
75-
item.filtered_by = item.filtered_by or {}
76-
item.filtered_by.name = true
77-
elseif f.never_show[name] then
74+
if f.never_show[name] then
7875
item.filtered_by = item.filtered_by or {}
7976
item.filtered_by.never_show = true
80-
elseif f.hide_dotfiles and string.sub(item.name, 1, 1) == "." then
77+
elseif f.hide_by_name[name] then
78+
item.filtered_by = item.filtered_by or {}
79+
item.filtered_by.name = true
80+
elseif f.hide_dotfiles and string.sub(name, 1, 1) == "." then
8181
item.filtered_by = item.filtered_by or {}
8282
item.filtered_by.dotfiles = true
8383
elseif f.hide_gitignored and utils.truthy(state.git_ignored) then

lua/neo-tree/sources/filesystem/init.lua

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -246,8 +246,14 @@ end
246246
--wants to change from the defaults. May be empty to accept default values.
247247
M.setup = function(config, global_config)
248248
config.filters = config.filters or {}
249-
local exclude = config.filters.exclude_items or {}
250-
config.filters.exclude_items = utils.list_to_dict(exclude)
249+
local hide_by_name = utils.get_value(config, "filtered_items.hide_by_name")
250+
if hide_by_name then
251+
config.filtered_items.hide_by_name = utils.list_to_dict(hide_by_name)
252+
end
253+
local never_show = utils.get_value(config, "filtered_items.never_show")
254+
if never_show then
255+
config.filtered_items.never_show = utils.list_to_dict(never_show)
256+
end
251257

252258
--Configure events for before_render
253259
if config.before_render then

0 commit comments

Comments
 (0)