chore: class new is now generic
This commit is contained in:
@@ -20,7 +20,7 @@ function DirectoryLinkNode:create(explorer, parent, absolute_path, link_to, name
|
||||
-- create DirectoryNode with the target path for the watcher
|
||||
local o = DirectoryNode:create(explorer, parent, link_to, name, fs_stat)
|
||||
|
||||
o = self:new(o) --[[@as DirectoryLinkNode]]
|
||||
o = self:new(o)
|
||||
|
||||
-- reset absolute path to the link itself
|
||||
o.absolute_path = absolute_path
|
||||
|
||||
@@ -43,7 +43,7 @@ function DirectoryNode:create(explorer, parent, absolute_path, name, fs_stat)
|
||||
open = false,
|
||||
hidden_stats = nil,
|
||||
}
|
||||
o = self:new(o) --[[@as DirectoryNode]]
|
||||
o = self:new(o)
|
||||
|
||||
o.watcher = require("nvim-tree.explorer.watch").create_watcher(o)
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ local FileLinkNode = FileNode:new()
|
||||
function FileLinkNode:create(explorer, parent, absolute_path, link_to, name, fs_stat, fs_stat_target)
|
||||
local o = FileNode:create(explorer, parent, absolute_path, name, fs_stat)
|
||||
|
||||
o = self:new(o) --[[@as FileLinkNode]]
|
||||
o = self:new(o)
|
||||
|
||||
o.type = "link"
|
||||
o.link_to = link_to
|
||||
|
||||
@@ -31,7 +31,7 @@ function FileNode:create(explorer, parent, absolute_path, name, fs_stat)
|
||||
|
||||
extension = string.match(name, ".?[^.]+%.(.*)") or "",
|
||||
}
|
||||
o = self:new(o) --[[@as FileNode]]
|
||||
o = self:new(o)
|
||||
|
||||
return o
|
||||
end
|
||||
|
||||
@@ -12,7 +12,7 @@ local RootNode = DirectoryNode:new()
|
||||
function RootNode:create(explorer, absolute_path, name, fs_stat)
|
||||
local o = DirectoryNode:create(explorer, nil, absolute_path, name, fs_stat)
|
||||
|
||||
o = self:new(o) --[[@as RootNode]]
|
||||
o = self:new(o)
|
||||
|
||||
return o
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user