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