typechecked optargs constructors for decorators, WIP

This commit is contained in:
Alexander Courtis
2024-11-06 17:50:52 +11:00
parent 692fff7745
commit 4da6f4baaa
6 changed files with 93 additions and 89 deletions

View File

@@ -1,4 +1,4 @@
local Class = require("nvim-tree.class")
local Class = require("nvim-tree.classic")
local HL_POSITION = require("nvim-tree.enum").HL_POSITION
local ICON_PLACEMENT = require("nvim-tree.enum").ICON_PLACEMENT
@@ -10,7 +10,24 @@ local ICON_PLACEMENT = require("nvim-tree.enum").ICON_PLACEMENT
---@field protected enabled boolean
---@field protected hl_pos HL_POSITION
---@field protected icon_placement ICON_PLACEMENT
local Decorator = Class:new()
local Decorator = Class:extend()
---@class (exact) DecoratorArgs
---@field explorer Explorer
---@class (exact) AbstractDecoratorArgs: DecoratorArgs
---@field enabled boolean
---@field hl_pos HL_POSITION
---@field icon_placement ICON_PLACEMENT
---@protected
---@param args AbstractDecoratorArgs
function Decorator:new(args)
self.explorer = args.explorer
self.enabled = args.enabled
self.hl_pos = args.hl_pos
self.icon_placement = args.icon_placement
end
---Maybe highlight groups
---@param node Node