@@ -15,7 +15,8 @@ local Preview = require("neo-tree.sources.common.preview")
15
15
--- @param tree table to look for nodes
16
16
--- @param node table to look for folder parent
17
17
--- @return table table
18
- local function get_folder_node (tree , node )
18
+ local function get_folder_node (state , node )
19
+ local tree = state .tree
19
20
if not node then
20
21
node = tree :get_node ()
21
22
end
@@ -27,7 +28,7 @@ local function get_folder_node(tree, node)
27
28
if node .type == " directory" then
28
29
return node
29
30
end
30
- return get_folder_node (tree , tree :get_node (node :get_parent_id ()))
31
+ return get_folder_node (state , tree :get_node (node :get_parent_id ()))
31
32
end
32
33
33
34
--- The using_root_directory is used to decide what part of the filename to show
36
37
--- @return string The root path from which the relative source path should be taken
37
38
local function get_using_root_directory (state )
38
39
-- default to showing only the basename of the path
39
- local using_root_directory = get_folder_node (state . tree ):get_id ()
40
+ local using_root_directory = get_folder_node (state ):get_id ()
40
41
local show_path = state .config .show_path
41
42
if show_path == " absolute" then
42
43
using_root_directory = " "
70
71
--- @param state table The state of the source
71
72
--- @param callback function The callback to call when the command is done. Called with the parent node as the argument.
72
73
M .add = function (state , callback )
73
- local tree = state .tree
74
- local node = get_folder_node (tree )
74
+ local node = get_folder_node (state )
75
75
local in_directory = node :get_id ()
76
76
local using_root_directory = get_using_root_directory (state )
77
77
fs_actions .create_node (in_directory , callback , using_root_directory )
81
81
--- @param state table The state of the source
82
82
--- @param callback function The callback to call when the command is done. Called with the parent node as the argument.
83
83
M .add_directory = function (state , callback )
84
- local tree = state .tree
85
- local node = get_folder_node (tree )
84
+ local node = get_folder_node (state )
86
85
local in_directory = node :get_id ()
87
86
local using_root_directory = get_using_root_directory (state )
88
87
fs_actions .create_directory (in_directory , callback , using_root_directory )
361
360
--- @param callback function The callback to call when the command is done. Called with the parent node as the argument.
362
361
M .paste_from_clipboard = function (state , callback )
363
362
if state .clipboard then
364
- local folder = get_folder_node (state . tree ):get_id ()
363
+ local folder = get_folder_node (state ):get_id ()
365
364
-- Convert to list so to make it easier to pop items from the stack.
366
365
local clipboard_list = {}
367
366
for _ , item in pairs (state .clipboard ) do
0 commit comments