* fix(#1731): watcher refreshes node rather than the first node matching absolute path, profile refresh
* fix(#1731): reload explorer reloads closed folders
* fix(#1731): do not fire folder created event on file create
* fix(#1731): reload profile absolute path, not link to
* fix(#1731): find-file locks/profiles on real path, reloads when watchers disabled
* Revert "fix(#1731): reload explorer reloads closed folders"
This reverts commit 5dfd8bd2fa.
* fix(#1731): tidy watch reload
* fix(#1731): move refresh_node from watch to reload
* fix(#1731): find-file reloads all nodes for the containing directory
* fix(#1731): create-file refreshes synchronously
* fix(#1731): remove unused watch node
* fix(#1731): find-file refreshes root
* fix(#1716): create-file invokes find-file
* fix(#1731): refresh path walks down the tree to the targedt
This commit is contained in:
committed by
GitHub
parent
99d713644d
commit
b17358ff4d
@@ -3,6 +3,7 @@ local view = require "nvim-tree.view"
|
||||
local utils = require "nvim-tree.utils"
|
||||
local renderer = require "nvim-tree.renderer"
|
||||
local core = require "nvim-tree.core"
|
||||
local reload = require "nvim-tree.explorer.reload"
|
||||
local Iterator = require "nvim-tree.iterators.node-iterator"
|
||||
|
||||
local M = {}
|
||||
@@ -12,18 +13,26 @@ local running = {}
|
||||
---Find a path in the tree, expand it and focus it
|
||||
---@param fname string full path
|
||||
function M.fn(fname)
|
||||
if running[fname] or not core.get_explorer() then
|
||||
if not core.get_explorer() then
|
||||
return
|
||||
end
|
||||
running[fname] = true
|
||||
|
||||
local ps = log.profile_start("find file %s", fname)
|
||||
-- always match against the real path
|
||||
local fname_real = vim.loop.fs_realpath(fname)
|
||||
if not fname_real then
|
||||
return
|
||||
end
|
||||
|
||||
if running[fname_real] then
|
||||
return
|
||||
end
|
||||
running[fname_real] = true
|
||||
|
||||
local ps = log.profile_start("find file %s", fname_real)
|
||||
|
||||
-- we cannot wait for watchers
|
||||
reload.refresh_nodes_for_path(vim.fn.fnamemodify(fname_real, ":h"))
|
||||
|
||||
local line = core.get_nodes_starting_line()
|
||||
|
||||
local absolute_paths_searched = {}
|
||||
@@ -60,9 +69,9 @@ function M.fn(fname)
|
||||
view.set_cursor { line, 0 }
|
||||
end
|
||||
|
||||
running[fname] = false
|
||||
running[fname_real] = false
|
||||
|
||||
log.profile_end(ps, "find file %s", fname)
|
||||
log.profile_end(ps, "find file %s", fname_real)
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
Reference in New Issue
Block a user