From dba9d5ddfad01d0c8d172393ab78b9d37dce59ae Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Sat, 16 Jul 2022 13:06:51 +0800 Subject: [PATCH 1/3] fix(explorer): reload `executable` stat --- lua/nvim-tree/explorer/node-builders.lua | 4 ++-- lua/nvim-tree/explorer/reload.lua | 3 +++ 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/lua/nvim-tree/explorer/node-builders.lua b/lua/nvim-tree/explorer/node-builders.lua index 1d7c1f8403e..a6ffa7d76c9 100644 --- a/lua/nvim-tree/explorer/node-builders.lua +++ b/lua/nvim-tree/explorer/node-builders.lua @@ -23,7 +23,7 @@ function M.folder(parent, absolute_path, name) } end -local function is_executable(absolute_path, ext) +function M.is_executable(absolute_path, ext) if M.is_windows then return utils.is_windows_exe(ext) end @@ -35,7 +35,7 @@ function M.file(parent, absolute_path, name) return { absolute_path = absolute_path, - executable = is_executable(absolute_path, ext), + executable = M.is_executable(absolute_path, ext), extension = ext, fs_stat = uv.fs_stat(absolute_path), name = name, diff --git a/lua/nvim-tree/explorer/reload.lua b/lua/nvim-tree/explorer/reload.lua index e26a68b0a92..1f2042458e3 100644 --- a/lua/nvim-tree/explorer/reload.lua +++ b/lua/nvim-tree/explorer/reload.lua @@ -62,7 +62,10 @@ function M.reload(node, status) table.insert(node.nodes, link) end end + end + local n = nodes_by_path[abs] + n.executable = builders.is_executable(abs, n.extension) end end From 1e2ef08287dec6b2a866f40d732cb9aec741ee33 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Mon, 18 Jul 2022 11:31:48 +0800 Subject: [PATCH 2/3] fix: remove empty lines --- lua/nvim-tree/explorer/reload.lua | 1 - 1 file changed, 1 deletion(-) diff --git a/lua/nvim-tree/explorer/reload.lua b/lua/nvim-tree/explorer/reload.lua index 1f2042458e3..68bf3805d5f 100644 --- a/lua/nvim-tree/explorer/reload.lua +++ b/lua/nvim-tree/explorer/reload.lua @@ -62,7 +62,6 @@ function M.reload(node, status) table.insert(node.nodes, link) end end - end local n = nodes_by_path[abs] n.executable = builders.is_executable(abs, n.extension) From 11c619a216a33d36040b3eaf6c866707e69b8140 Mon Sep 17 00:00:00 2001 From: Klesh Wong Date: Tue, 19 Jul 2022 09:45:44 +0800 Subject: [PATCH 3/3] fix: check if `n` exists --- lua/nvim-tree/explorer/reload.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua/nvim-tree/explorer/reload.lua b/lua/nvim-tree/explorer/reload.lua index 68bf3805d5f..e9785c47a55 100644 --- a/lua/nvim-tree/explorer/reload.lua +++ b/lua/nvim-tree/explorer/reload.lua @@ -64,7 +64,9 @@ function M.reload(node, status) end end local n = nodes_by_path[abs] - n.executable = builders.is_executable(abs, n.extension) + if n then + n.executable = builders.is_executable(abs, n.extension) + end end end