use supers for node methods
This commit is contained in:
parent
92fa49051f
commit
9fc7a866ec
@ -28,7 +28,7 @@ function DirectoryLinkNode:new(args)
|
||||
end
|
||||
|
||||
function DirectoryLinkNode:destroy()
|
||||
DirectoryNode.destroy(self)
|
||||
self.super.destroy(self)
|
||||
end
|
||||
|
||||
---Update the directory git_status of link target and the file status of the link itself
|
||||
@ -60,7 +60,7 @@ end
|
||||
---Maybe override name with arrow
|
||||
---@return HighlightedString name
|
||||
function DirectoryLinkNode:highlighted_name()
|
||||
local name = DirectoryNode.highlighted_name(self)
|
||||
local name = self.super.highlighted_name(self)
|
||||
|
||||
if self.explorer.opts.renderer.symlink_destination then
|
||||
local link_to = utils.path_relative(self.link_to, self.explorer.absolute_path)
|
||||
@ -74,7 +74,7 @@ end
|
||||
---Create a sanitized partial copy of a node, populating children recursively.
|
||||
---@return DirectoryLinkNode cloned
|
||||
function DirectoryLinkNode:clone()
|
||||
local clone = DirectoryNode.clone(self) --[[@as DirectoryLinkNode]]
|
||||
local clone = self.super.clone(self) --[[@as DirectoryLinkNode]]
|
||||
|
||||
clone.link_to = self.link_to
|
||||
clone.fs_stat_target = self.fs_stat_target
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
local git_utils = require("nvim-tree.git.utils")
|
||||
local icons = require("nvim-tree.renderer.components.devicons")
|
||||
local notify = require("nvim-tree.notify")
|
||||
|
||||
local Node = require("nvim-tree.node")
|
||||
|
||||
---@class (exact) DirectoryNode: Node
|
||||
@ -46,7 +47,7 @@ function DirectoryNode:destroy()
|
||||
end
|
||||
end
|
||||
|
||||
Node.destroy(self)
|
||||
self.super.destroy(self)
|
||||
end
|
||||
|
||||
---Update the git_status of the directory
|
||||
@ -272,7 +273,7 @@ end
|
||||
---Create a sanitized partial copy of a node, populating children recursively.
|
||||
---@return DirectoryNode cloned
|
||||
function DirectoryNode:clone()
|
||||
local clone = Node.clone(self) --[[@as DirectoryNode]]
|
||||
local clone = self.super.clone(self) --[[@as DirectoryNode]]
|
||||
|
||||
clone.has_children = self.has_children
|
||||
clone.group_next = nil
|
||||
|
||||
@ -21,7 +21,7 @@ function FileLinkNode:new(args)
|
||||
end
|
||||
|
||||
function FileLinkNode:destroy()
|
||||
FileNode.destroy(self)
|
||||
self.super.destroy(self)
|
||||
end
|
||||
|
||||
---Update the git_status of the target otherwise the link itself
|
||||
@ -60,7 +60,7 @@ end
|
||||
---Create a sanitized partial copy of a node
|
||||
---@return FileLinkNode cloned
|
||||
function FileLinkNode:clone()
|
||||
local clone = FileNode.clone(self) --[[@as FileLinkNode]]
|
||||
local clone = self.super.clone(self) --[[@as FileLinkNode]]
|
||||
|
||||
clone.link_to = self.link_to
|
||||
clone.fs_stat_target = self.fs_stat_target
|
||||
|
||||
@ -31,7 +31,7 @@ function FileNode:new(args)
|
||||
end
|
||||
|
||||
function FileNode:destroy()
|
||||
Node.destroy(self)
|
||||
self.super.destroy(self)
|
||||
end
|
||||
|
||||
---Update the GitStatus of the file
|
||||
@ -96,7 +96,7 @@ end
|
||||
---Create a sanitized partial copy of a node
|
||||
---@return FileNode cloned
|
||||
function FileNode:clone()
|
||||
local clone = Node.clone(self) --[[@as FileNode]]
|
||||
local clone = self.super.clone(self) --[[@as FileNode]]
|
||||
|
||||
clone.extension = self.extension
|
||||
|
||||
|
||||
@ -19,7 +19,7 @@ function RootNode:is_dotfile()
|
||||
end
|
||||
|
||||
function RootNode:destroy()
|
||||
DirectoryNode.destroy(self)
|
||||
self.super.destroy(self)
|
||||
end
|
||||
|
||||
return RootNode
|
||||
|
||||
@ -4,7 +4,6 @@ local Class = require("nvim-tree.classic")
|
||||
---@alias DecoratorIconPlacement "none" | "before" | "after" | "signcolumn" | "right_align"
|
||||
|
||||
---Abstract Decorator
|
||||
---Uses the factory pattern to instantiate child instances.
|
||||
---@class (exact) Decorator: Class
|
||||
---@field protected explorer Explorer
|
||||
---@field protected enabled boolean
|
||||
|
||||
Loading…
Reference in New Issue
Block a user