Skip to content

Commit f2a926d

Browse files
committed
feat(#2948): add UserDecorator
1 parent 24eb27e commit f2a926d

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

lua/nvim-tree/renderer/builder.lua

-5
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,6 @@ local DecoratorOpened = require("nvim-tree.renderer.decorator.opened")
1616

1717
local pad = require("nvim-tree.renderer.components.padding")
1818

19-
---TODO move all these classes to API meta
20-
---@class (exact) HighlightedString
21-
---@field str string
22-
---@field hl string[]
23-
2419
---@class (exact) AddHighlightArgs
2520
---@field group string[]
2621
---@field line number

lua/nvim-tree/renderer/decorator/meta.lua

+5
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,8 @@
1111
---@field enabled boolean
1212
---@field highlight_range DecoratorHighlightRange
1313
---@field icon_placement DecoratorIconPlacement
14+
15+
---A string for rendering, with optional highlight groups to apply to it
16+
---@class (exact) HighlightedString
17+
---@field str string
18+
---@field hl string[]

lua/nvim-tree/renderer/decorator/user.lua

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ local Decorator = require("nvim-tree.renderer.decorator")
22

33
---Abstract user decorator, extend to define your own.
44
---Icon and highlight are optional.
5-
---Constructor will be called once per tree render, with no arguments:
5+
---Mandatory constructor will be called once per tree render, with no arguments:
66
--- Must call super passing DecoratorArgs: MyDecorator.super.new(self, args)
77
--- Must call define_sign, when using "signcolumn"
88
---See example at end.
99

1010
---@class (exact) UserDecorator: Decorator
1111
local UserDecorator = Decorator:extend()
1212

13-
---Override this method to provide icons and the highlight groups to apply to them
13+
---Override this method to provide icons and the highlight groups to apply to DecoratorIconPlacement
1414
---@param node Node
1515
---@return HighlightedString[]? icons
1616
function UserDecorator:calculate_icons(node)

0 commit comments

Comments
 (0)