From 02384a9dbfa74eb75de50f3dbba4491dff9e986b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Gottz=C3=A9n?= Date: Tue, 18 Jan 2022 16:35:44 +0100 Subject: [PATCH] fix(files): fixes #71, toggle the correct flags. Toggle the state.filters.(show_hidden|respect_gitignore) flags, instead of setting them on the root state object. --- lua/neo-tree/sources/filesystem/commands.lua | 4 ++-- lua/neo-tree/sources/filesystem/lib/fs_scan.lua | 5 +++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/lua/neo-tree/sources/filesystem/commands.lua b/lua/neo-tree/sources/filesystem/commands.lua index efdfa146..bd22ef26 100644 --- a/lua/neo-tree/sources/filesystem/commands.lua +++ b/lua/neo-tree/sources/filesystem/commands.lua @@ -95,13 +95,13 @@ end ---Toggles whether hidden files are shown or not. M.toggle_hidden = function(state) - state.show_hidden = not state.show_hidden + state.filters.show_hidden = not state.filters.show_hidden fs.show() end ---Toggles whether the tree is filtered by gitignore or not. M.toggle_gitignore = function(state) - state.respect_gitignore = not state.respect_gitignore + state.filters.respect_gitignore = not state.filters.respect_gitignore fs.show() end diff --git a/lua/neo-tree/sources/filesystem/lib/fs_scan.lua b/lua/neo-tree/sources/filesystem/lib/fs_scan.lua index fc63f3d7..f7ab45d9 100644 --- a/lua/neo-tree/sources/filesystem/lib/fs_scan.lua +++ b/lua/neo-tree/sources/filesystem/lib/fs_scan.lua @@ -16,10 +16,11 @@ local function do_scan(context, path_to_scan) local state = context.state local paths_to_load = context.paths_to_load local folders = context.folders + local filters = state.filters scan.scan_dir_async(path_to_scan, { - hidden = state.show_hidden or false, - respect_gitignore = state.respect_gitignore or false, + hidden = filters.show_hidden or false, + respect_gitignore = filters.respect_gitignore or false, search_pattern = state.search_pattern or nil, add_dirs = true, depth = 1,