@@ -3,7 +3,6 @@ local log = require "nvim-tree.log"
3
3
local notify = require " nvim-tree.notify"
4
4
local utils = require " nvim-tree.utils"
5
5
local view = require " nvim-tree.view"
6
- local watch = require " nvim-tree.explorer.watch"
7
6
local explorer_node = require " nvim-tree.explorer.node"
8
7
9
8
local BaseNode = require " nvim-tree.node"
@@ -26,19 +25,15 @@ local FILTER_REASON = require("nvim-tree.enum").FILTER_REASON
26
25
27
26
local config
28
27
29
- --- @class Explorer : BaseNode
28
+ --- @class ( exact ) Explorer : DirectoryNode
30
29
--- @field opts table user options
31
- --- @field absolute_path string
32
- --- @field nodes Node[]
33
- --- @field open boolean
34
- --- @field watcher Watcher | nil
35
30
--- @field renderer Renderer
36
31
--- @field filters Filters
37
32
--- @field live_filter LiveFilter
38
33
--- @field sorters Sorter
39
34
--- @field marks Marks
40
35
--- @field clipboard Clipboard
41
- local Explorer = BaseNode : new ()
36
+ local Explorer = BaseNode . new (DirectoryNode ) -- TODO do not inherit, add a root node to separate Explorer and Node
42
37
43
38
--- @param path string | nil
44
39
--- @return Explorer | nil
@@ -56,27 +51,16 @@ function Explorer:new(path)
56
51
end
57
52
58
53
--- @type Explorer
59
- local placeholder
60
-
61
- local o = BaseNode .new (self , {
62
- type = " directory" ,
63
- explorer = placeholder ,
64
- absolute_path = path ,
65
- executable = false ,
66
- hidden = false ,
67
- is_dot = false ,
68
-
69
- has_children = false ,
70
- group_next = nil ,
71
- nodes = {},
72
- open = true ,
73
- })
54
+ local placeholder = nil
55
+
56
+ local o = DirectoryNode .new (self , placeholder , nil , path , nil , nil )
74
57
--- @cast o Explorer
75
58
76
59
o .explorer = self
60
+ o .open = true
61
+
77
62
o .opts = config
78
63
o .sorters = Sorters :new (config )
79
- o .watcher = watch .create_watcher (o )
80
64
o .renderer = Renderer :new (config , o )
81
65
o .filters = Filters :new (config , o )
82
66
o .live_filter = LiveFilter :new (config , o )
@@ -490,7 +474,7 @@ function Explorer:reload_git()
490
474
event_running = false
491
475
end
492
476
493
- function Explorer . setup (opts )
477
+ function Explorer : setup (opts )
494
478
config = opts
495
479
require (" nvim-tree.explorer.node" ).setup (opts )
496
480
require (" nvim-tree.explorer.watch" ).setup (opts )
0 commit comments