replace enums with named maps

This commit is contained in:
Alexander Courtis
2024-11-08 11:36:42 +11:00
parent 5d7e5434f3
commit 9af0dc487d
11 changed files with 45 additions and 92 deletions

View File

@@ -1,6 +1,3 @@
local HL_POSITION = require("nvim-tree.enum").HL_POSITION
local ICON_PLACEMENT = require("nvim-tree.enum").ICON_PLACEMENT
local Decorator = require("nvim-tree.renderer.decorator")
---@class (exact) DecoratorCopied: Decorator
@@ -15,8 +12,8 @@ function DecoratorCopied:new(args)
Decorator.new(self, {
explorer = args.explorer,
enabled = true,
hl_pos = HL_POSITION[args.explorer.opts.renderer.highlight_clipboard] or HL_POSITION.none,
icon_placement = ICON_PLACEMENT.none,
hl_pos = args.explorer.opts.renderer.highlight_clipboard or "none",
icon_placement = "none",
})
end
@@ -24,7 +21,7 @@ end
---@param node Node
---@return string|nil group
function DecoratorCopied:calculate_highlight(node)
if self.hl_pos ~= HL_POSITION.none and self.explorer.clipboard:is_copied(node) then
if self.range ~= "none" and self.explorer.clipboard:is_copied(node) then
return "NvimTreeCopiedHL"
end
end