fix(#549): add more profiling ~tree init
This commit is contained in:
@@ -2,6 +2,7 @@ local events = require "nvim-tree.events"
|
||||
local explorer = require "nvim-tree.explorer"
|
||||
local live_filter = require "nvim-tree.live-filter"
|
||||
local view = require "nvim-tree.view"
|
||||
local log = require "nvim-tree.log"
|
||||
|
||||
local M = {}
|
||||
|
||||
@@ -9,6 +10,9 @@ TreeExplorer = nil
|
||||
local first_init_done = false
|
||||
|
||||
function M.init(foldername)
|
||||
local pn = string.format("core init %s", foldername)
|
||||
local ps = log.profile_start(pn)
|
||||
|
||||
if TreeExplorer then
|
||||
TreeExplorer:destroy()
|
||||
end
|
||||
@@ -17,6 +21,7 @@ function M.init(foldername)
|
||||
events._dispatch_ready()
|
||||
first_init_done = true
|
||||
end
|
||||
log.profile_end(ps, pn)
|
||||
end
|
||||
|
||||
function M.get_explorer()
|
||||
|
||||
@@ -5,6 +5,7 @@ local sorters = require "nvim-tree.explorer.sorters"
|
||||
local filters = require "nvim-tree.explorer.filters"
|
||||
local live_filter = require "nvim-tree.live-filter"
|
||||
local notify = require "nvim-tree.notify"
|
||||
local log = require "nvim-tree.log"
|
||||
|
||||
local M = {}
|
||||
|
||||
@@ -61,6 +62,9 @@ function M.explore(node, status)
|
||||
return
|
||||
end
|
||||
|
||||
local pn = string.format("explore init %s", node.absolute_path)
|
||||
local ps = log.profile_start(pn)
|
||||
|
||||
populate_children(handle, cwd, node, status)
|
||||
|
||||
local is_root = not node.parent
|
||||
@@ -69,11 +73,15 @@ function M.explore(node, status)
|
||||
node.group_next = child_folder_only
|
||||
local ns = M.explore(child_folder_only, status)
|
||||
node.nodes = ns or {}
|
||||
|
||||
log.profile_end(ps, pn)
|
||||
return ns
|
||||
end
|
||||
|
||||
sorters.merge_sort(node.nodes, sorters.node_comparator)
|
||||
live_filter.apply_filter(node)
|
||||
|
||||
log.profile_end(ps, pn)
|
||||
return node.nodes
|
||||
end
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ local M = {}
|
||||
|
||||
local events = require "nvim-tree.events"
|
||||
local utils = require "nvim-tree.utils"
|
||||
local log = require "nvim-tree.log"
|
||||
|
||||
local function get_win_sep_hl()
|
||||
-- #1221 WinSeparator not present in nvim 0.6.1 and some builds of 0.7.0
|
||||
@@ -231,6 +232,9 @@ function M.open(options)
|
||||
return
|
||||
end
|
||||
|
||||
local pn = string.format "view open"
|
||||
local ps = log.profile_start(pn)
|
||||
|
||||
create_buffer()
|
||||
open_window()
|
||||
M.resize()
|
||||
@@ -240,6 +244,8 @@ function M.open(options)
|
||||
vim.cmd "wincmd p"
|
||||
end
|
||||
events._dispatch_on_tree_open()
|
||||
|
||||
log.profile_end(ps, pn)
|
||||
end
|
||||
|
||||
local function grow()
|
||||
|
||||
Reference in New Issue
Block a user