fix(#1831): remove windows executable functionality due to occasional vim freeze and performance concerns (#1868)
* #1831 exploratory testing: disable file executable checks * fix(#1831): remove windows executable functionality
This commit is contained in:
committed by
GitHub
parent
9e4c39572f
commit
3c4958ab3d
@@ -23,6 +23,10 @@ local function populate_children(handle, cwd, node, git_status)
|
||||
end
|
||||
|
||||
local abs = utils.path_join { cwd, name }
|
||||
|
||||
local pn = string.format("explore populate_children %s", abs)
|
||||
local ps = log.profile_start(pn)
|
||||
|
||||
t = get_type_from(t, abs)
|
||||
if not filters.should_filter(abs, filter_status) and not nodes_by_path[abs] then
|
||||
local child = nil
|
||||
@@ -42,6 +46,8 @@ local function populate_children(handle, cwd, node, git_status)
|
||||
explorer_node.update_git_status(child, node_ignored, git_status)
|
||||
end
|
||||
end
|
||||
|
||||
log.profile_end(ps, pn)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
local utils = require "nvim-tree.utils"
|
||||
local watch = require "nvim-tree.explorer.watch"
|
||||
|
||||
local M = {
|
||||
is_windows = vim.fn.has "win32" == 1,
|
||||
is_wsl = vim.fn.has "wsl" == 1,
|
||||
}
|
||||
local M = {}
|
||||
|
||||
function M.folder(parent, absolute_path, name)
|
||||
local handle = utils.fs_scandir_profiled(absolute_path)
|
||||
@@ -27,21 +24,16 @@ function M.folder(parent, absolute_path, name)
|
||||
return node
|
||||
end
|
||||
|
||||
function M.is_executable(parent, absolute_path, ext)
|
||||
if M.is_windows then
|
||||
return utils.is_windows_exe(ext)
|
||||
elseif M.is_wsl then
|
||||
if parent.is_wsl_windows_fs_path == nil then
|
||||
-- Evaluate lazily when needed and do so only once for each parent
|
||||
-- as 'wslpath' calls can get expensive in highly populated directories.
|
||||
parent.is_wsl_windows_fs_path = utils.is_wsl_windows_fs_path(absolute_path)
|
||||
end
|
||||
|
||||
if parent.is_wsl_windows_fs_path then
|
||||
return utils.is_wsl_windows_fs_exe(ext)
|
||||
end
|
||||
--- path is an executable file or directory
|
||||
--- @param absolute_path string
|
||||
--- @return boolean
|
||||
function M.is_executable(absolute_path)
|
||||
if utils.is_windows or utils.is_wsl then
|
||||
--- executable detection on windows is buggy and not performant hence it is disabled
|
||||
return false
|
||||
else
|
||||
return vim.loop.fs_access(absolute_path, "X")
|
||||
end
|
||||
return vim.loop.fs_access(absolute_path, "X")
|
||||
end
|
||||
|
||||
function M.file(parent, absolute_path, name)
|
||||
@@ -50,7 +42,7 @@ function M.file(parent, absolute_path, name)
|
||||
return {
|
||||
type = "file",
|
||||
absolute_path = absolute_path,
|
||||
executable = M.is_executable(parent, absolute_path, ext),
|
||||
executable = M.is_executable(absolute_path),
|
||||
extension = ext,
|
||||
fs_stat = vim.loop.fs_stat(absolute_path),
|
||||
name = name,
|
||||
|
||||
@@ -104,7 +104,7 @@ function M.reload(node, git_status, unloaded_bufnr)
|
||||
else
|
||||
local n = nodes_by_path[abs]
|
||||
if n then
|
||||
n.executable = builders.is_executable(n.parent, abs, n.extension or "")
|
||||
n.executable = builders.is_executable(abs)
|
||||
n.fs_stat = fs_stat_cached(abs)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user