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,4 +1,5 @@
local notify = require("nvim-tree.notify")
local explorer_node = require("nvim-tree.explorer.node")
local HL_POSITION = require("nvim-tree.enum").HL_POSITION
local ICON_PLACEMENT = require("nvim-tree.enum").ICON_PLACEMENT
@@ -9,25 +10,23 @@ local Decorator = require("nvim-tree.renderer.decorator")
---@field ord number decreasing priority
---@class (exact) DecoratorGit: Decorator
---@field file_hl table<string, string>? by porcelain status e.g. "AM"
---@field folder_hl table<string, string>? by porcelain status
---@field icons_by_status HighlightedStringGit[]? by human status
---@field icons_by_xy table<string, HighlightedStringGit[]>? by porcelain status
---@field file_hl table<string, string> by porcelain status e.g. "AM"
---@field folder_hl table<string, string> by porcelain status
---@field icons_by_status HighlightedStringGit[] by human status
---@field icons_by_xy table<string, HighlightedStringGit[]> by porcelain status
local DecoratorGit = Decorator:new()
---Static factory method
---@param opts table
---@param explorer Explorer
---@return DecoratorGit
function DecoratorGit:create(opts, explorer)
---@type DecoratorGit
local o = {
function DecoratorGit:new(opts, explorer)
local o = Decorator.new(self, {
explorer = explorer,
enabled = opts.git.enable,
hl_pos = HL_POSITION[opts.renderer.highlight_git] or HL_POSITION.none,
icon_placement = ICON_PLACEMENT[opts.renderer.icons.git_placement] or ICON_PLACEMENT.none,
}
o = self:new(o) --[[@as DecoratorGit]]
})
---@cast o DecoratorGit
if not o.enabled then
return o
@@ -148,7 +147,7 @@ function DecoratorGit:calculate_icons(node)
return nil
end
local git_status = node:get_git_status()
local git_status = explorer_node.get_git_status(node)
if git_status == nil then
return nil
end
@@ -209,7 +208,7 @@ function DecoratorGit:calculate_highlight(node)
return nil
end
local git_status = node:get_git_status()
local git_status = explorer_node.get_git_status(node)
if not git_status then
return nil
end