Revert "refactor(#2871, #2886): multi instance: node classes created (#2916)"

This reverts commit 38aac09151.
This commit is contained in:
Alexander Courtis
2024-10-08 18:07:47 +11:00
parent 010ae0365a
commit 50e919426a
43 changed files with 742 additions and 835 deletions

View File

@@ -1,49 +0,0 @@
local utils = require("nvim-tree.utils")
local BaseNode = require("nvim-tree.node")
---@class (exact) FileNode: BaseNode
---@field extension string
local FileNode = BaseNode:new()
---Static factory method
---@param explorer Explorer
---@param parent Node
---@param absolute_path string
---@param name string
---@param fs_stat uv.fs_stat.result?
---@return FileNode
function FileNode:create(explorer, parent, absolute_path, name, fs_stat)
---@type FileNode
local o = {
type = "file",
explorer = explorer,
absolute_path = absolute_path,
executable = utils.is_executable(absolute_path),
fs_stat = fs_stat,
git_status = nil,
hidden = false,
is_dot = false,
name = name,
parent = parent,
watcher = nil,
diag_status = nil,
extension = string.match(name, ".?[^.]+%.(.*)") or "",
}
o = self:new(o) --[[@as FileNode]]
return o
end
---Create a sanitized partial copy of a node, populating children recursively.
---@return FileNode cloned
function FileNode:clone()
local clone = BaseNode.clone(self) --[[@as FileNode]]
clone.extension = self.extension
return clone
end
return FileNode