refactor(#2942): multi instance: move utils functions to Explorer methods (#3200)

* refactor(#2942): multi instance: move find_node_line to Explorer

* refactor(#2942): multi instance: move get_node_from_path to Explorer

* refactor(#2942): multi instance: move focus_file to Explorer

* refactor(#2942): multi instance: move focus_node_or_parent to Explorer

* refactor(#2942): multi instance: move get_node_from_path to Explorer

* refactor(#2942): multi instance: move find_node to Explorer

* refactor(#2942): multi instance: move get_nodes_by_line to Explorer

* refactor(#2942): multi instance: remove unnecessary focus_file

* refactor(#2942): style
This commit is contained in:
Alexander Courtis
2025-09-08 16:26:42 +10:00
committed by GitHub
parent f92cc3a91c
commit e179ad2f83
11 changed files with 135 additions and 153 deletions

View File

@@ -1,4 +1,3 @@
local utils = require("nvim-tree.utils")
local core = require("nvim-tree.core")
local Iterator = require("nvim-tree.iterators.node-iterator")
@@ -12,9 +11,14 @@ function M.fn(direction)
return
end
local explorer = core.get_explorer()
if not explorer then
return
end
local first, last, next, prev = nil, nil, nil, nil
local found = false
local parent = node.parent or core.get_explorer()
local parent = node.parent or explorer
Iterator.builder(parent and parent.nodes or {})
:recursor(function()
return nil
@@ -45,7 +49,7 @@ function M.fn(direction)
end
if target_node then
utils.focus_file(target_node.absolute_path)
explorer:focus_node_or_parent(target_node)
end
end
end