* fix(#1615): focus created file when command line prompt requires confirmation * fix(#1615): focus created file when command line prompt requires confirmation
This commit is contained in:
parent
c5536db0b7
commit
be2b4f58e6
@ -4,6 +4,7 @@ local utils = require "nvim-tree.utils"
|
||||
local events = require "nvim-tree.events"
|
||||
local lib = require "nvim-tree.lib"
|
||||
local core = require "nvim-tree.core"
|
||||
local watch = require "nvim-tree.explorer.watch"
|
||||
|
||||
local M = {}
|
||||
|
||||
@ -107,11 +108,11 @@ function M.fn(node)
|
||||
events._dispatch_folder_created(new_file_path)
|
||||
if M.enable_reload then
|
||||
require("nvim-tree.actions.reloaders.reloaders").reload_explorer()
|
||||
else
|
||||
-- synchronous call required so that we may focus the file now
|
||||
watch.refresh_path(node.absolute_path)
|
||||
end
|
||||
-- INFO: defer needed when reload is automatic (watchers)
|
||||
vim.defer_fn(function()
|
||||
utils.focus_file(utils.path_remove_trailing(new_file_path))
|
||||
end, 150)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
@ -39,7 +39,7 @@ local function is_folder_ignored(path)
|
||||
return false
|
||||
end
|
||||
|
||||
local function refresh_path(path)
|
||||
function M.refresh_path(path)
|
||||
log.line("watcher", "node event executing '%s'", path)
|
||||
local n = utils.get_node_from_path(path)
|
||||
if not n then
|
||||
@ -65,7 +65,7 @@ function M.create_watcher(absolute_path)
|
||||
local function callback(watcher)
|
||||
log.line("watcher", "node event scheduled %s", watcher.context)
|
||||
utils.debounce(watcher.context, M.debounce_delay, function()
|
||||
refresh_path(watcher._path)
|
||||
M.refresh_path(watcher._path)
|
||||
end)
|
||||
end
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user