chore: remove TreeExplorer global variable (#2561)
This commit is contained in:
@@ -752,7 +752,7 @@ function M.purge_all_state()
|
|||||||
view.abandon_all_windows()
|
view.abandon_all_windows()
|
||||||
if core.get_explorer() ~= nil then
|
if core.get_explorer() ~= nil then
|
||||||
git.purge_state()
|
git.purge_state()
|
||||||
TreeExplorer = nil
|
core.reset_explorer()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ local log = require "nvim-tree.log"
|
|||||||
|
|
||||||
local M = {}
|
local M = {}
|
||||||
|
|
||||||
TreeExplorer = nil
|
local TreeExplorer = nil
|
||||||
local first_init_done = false
|
local first_init_done = false
|
||||||
|
|
||||||
function M.init(foldername)
|
function M.init(foldername)
|
||||||
@@ -27,6 +27,10 @@ function M.get_explorer()
|
|||||||
return TreeExplorer
|
return TreeExplorer
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M.reset_explorer()
|
||||||
|
TreeExplorer = nil
|
||||||
|
end
|
||||||
|
|
||||||
function M.get_cwd()
|
function M.get_cwd()
|
||||||
return TreeExplorer and TreeExplorer.absolute_path
|
return TreeExplorer and TreeExplorer.absolute_path
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ local function redraw()
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function reset_filter(node_)
|
local function reset_filter(node_)
|
||||||
node_ = node_ or TreeExplorer
|
node_ = node_ or require("nvim-tree.core").get_explorer()
|
||||||
Iterator.builder(node_.nodes)
|
Iterator.builder(node_.nodes)
|
||||||
:hidden()
|
:hidden()
|
||||||
:applier(function(node)
|
:applier(function(node)
|
||||||
@@ -79,7 +79,7 @@ function M.apply_filter(node_)
|
|||||||
node.hidden = not (has_nodes or (ok and is_match))
|
node.hidden = not (has_nodes or (ok and is_match))
|
||||||
end
|
end
|
||||||
|
|
||||||
iterate(node_ or TreeExplorer)
|
iterate(node_ or require("nvim-tree.core").get_explorer())
|
||||||
end
|
end
|
||||||
|
|
||||||
local function record_char()
|
local function record_char()
|
||||||
|
|||||||
Reference in New Issue
Block a user