refactor(#2826): explorer init logging
This commit is contained in:
parent
d822fdd822
commit
d1df6d45a4
@ -85,7 +85,7 @@ M.force_dirchange = add_profiling_to(function(foldername, should_open_view)
|
||||
if should_change_dir() then
|
||||
cd(M.options.global, foldername)
|
||||
end
|
||||
core.init(foldername)
|
||||
core.init(foldername, "change-dir")
|
||||
end
|
||||
|
||||
if should_open_view then
|
||||
|
||||
@ -9,9 +9,12 @@ local TreeExplorer = nil
|
||||
local first_init_done = false
|
||||
|
||||
---@param foldername string
|
||||
function M.init(foldername)
|
||||
---@param callsite string
|
||||
function M.init(foldername, callsite)
|
||||
local profile = log.profile_start("core init %s", foldername)
|
||||
|
||||
log.line("dev", "core.init(%s, %s)", foldername, callsite)
|
||||
|
||||
if TreeExplorer then
|
||||
TreeExplorer:destroy()
|
||||
end
|
||||
|
||||
@ -31,7 +31,7 @@ local DEFAULT_PADDING = 1
|
||||
---@field private width (fun():integer)|integer|string
|
||||
---@field private max_width integer
|
||||
---@field private padding integer
|
||||
---@field private bufnr_by_tab table<integer, integer> for diagnostics during multi instance
|
||||
---@field private bufnr_by_tab table<integer, integer> stored per tab until multi-instance is complete
|
||||
local View = Class:extend()
|
||||
|
||||
---@class View
|
||||
@ -617,7 +617,6 @@ end
|
||||
---@param callsite string
|
||||
---@return integer? winid
|
||||
function View:winid(tabpage, callsite)
|
||||
local winid = nil
|
||||
local bufnr = self.bufnr_by_tab[tabpage]
|
||||
|
||||
local msg = string.format("View:winid(%3s, %-20.20s)", tabpage, callsite)
|
||||
@ -625,7 +624,7 @@ function View:winid(tabpage, callsite)
|
||||
if bufnr then
|
||||
for _, w in pairs(vim.api.nvim_tabpage_list_wins(tabpage or 0)) do
|
||||
if vim.api.nvim_win_get_buf(w) == bufnr then
|
||||
log.line("dev", "%s b%d : w%s", msg, bufnr, winid)
|
||||
log.line("dev", "%s b%d : w%s", msg, bufnr, w)
|
||||
return w
|
||||
end
|
||||
end
|
||||
|
||||
@ -102,14 +102,14 @@ function M.open(opts)
|
||||
M.set_target_win()
|
||||
if not core.get_explorer() or opts.path then
|
||||
if opts.path then
|
||||
core.init(opts.path)
|
||||
core.init(opts.path, "lib.open - opts.path")
|
||||
else
|
||||
local cwd, err = vim.loop.cwd()
|
||||
if not cwd then
|
||||
notify.error(string.format("current working directory unavailable: %s", err))
|
||||
return
|
||||
end
|
||||
core.init(cwd)
|
||||
core.init(cwd, "lib.open - cwd")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user