feat(#2948): add UserDecorator

This commit is contained in:
Alexander Courtis 2024-11-22 12:38:17 +11:00
parent 24eb27ebba
commit f2a926d608
3 changed files with 7 additions and 7 deletions

View File

@ -16,11 +16,6 @@ local DecoratorOpened = require("nvim-tree.renderer.decorator.opened")
local pad = require("nvim-tree.renderer.components.padding")
---TODO move all these classes to API meta
---@class (exact) HighlightedString
---@field str string
---@field hl string[]
---@class (exact) AddHighlightArgs
---@field group string[]
---@field line number

View File

@ -11,3 +11,8 @@
---@field enabled boolean
---@field highlight_range DecoratorHighlightRange
---@field icon_placement DecoratorIconPlacement
---A string for rendering, with optional highlight groups to apply to it
---@class (exact) HighlightedString
---@field str string
---@field hl string[]

View File

@ -2,7 +2,7 @@ local Decorator = require("nvim-tree.renderer.decorator")
---Abstract user decorator, extend to define your own.
---Icon and highlight are optional.
---Constructor will be called once per tree render, with no arguments:
---Mandatory constructor will be called once per tree render, with no arguments:
--- Must call super passing DecoratorArgs: MyDecorator.super.new(self, args)
--- Must call define_sign, when using "signcolumn"
---See example at end.
@ -10,7 +10,7 @@ local Decorator = require("nvim-tree.renderer.decorator")
---@class (exact) UserDecorator: Decorator
local UserDecorator = Decorator:extend()
---Override this method to provide icons and the highlight groups to apply to them
---Override this method to provide icons and the highlight groups to apply to DecoratorIconPlacement
---@param node Node
---@return HighlightedString[]? icons
function UserDecorator:calculate_icons(node)