* Reapply "refactor(#2871, #2886): multi instance: node classes created (#2916)"
This reverts commit 50e919426a.
* fix(#2945): stack overflow on api.git.reload or fugitive event
This commit is contained in:
committed by
GitHub
parent
50e919426a
commit
5ad87620ec
@@ -1,5 +1,4 @@
|
||||
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
|
||||
@@ -10,23 +9,25 @@ 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:new(opts, explorer)
|
||||
local o = Decorator.new(self, {
|
||||
function DecoratorGit:create(opts, explorer)
|
||||
---@type DecoratorGit
|
||||
local o = {
|
||||
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,
|
||||
})
|
||||
---@cast o DecoratorGit
|
||||
}
|
||||
o = self:new(o) --[[@as DecoratorGit]]
|
||||
|
||||
if not o.enabled then
|
||||
return o
|
||||
@@ -147,7 +148,7 @@ function DecoratorGit:calculate_icons(node)
|
||||
return nil
|
||||
end
|
||||
|
||||
local git_status = explorer_node.get_git_status(node)
|
||||
local git_status = node:get_git_status()
|
||||
if git_status == nil then
|
||||
return nil
|
||||
end
|
||||
@@ -208,7 +209,7 @@ function DecoratorGit:calculate_highlight(node)
|
||||
return nil
|
||||
end
|
||||
|
||||
local git_status = explorer_node.get_git_status(node)
|
||||
local git_status = node:get_git_status()
|
||||
if not git_status then
|
||||
return nil
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user