@@ -14,7 +14,7 @@ error("Cannot require a meta file")
1414--- ```lua
1515---
1616--- local MyDecorator = require("my-decorator")
17- ---
17+ ---
1818--- require("nvim-tree").setup({
1919--- renderer = {
2020--- decorators = {
@@ -40,25 +40,25 @@ error("Cannot require a meta file")
4040--- ---@field private my_icon_node nvim_tree.api.highlighted_string
4141--- ---@field private my_highlight_group string
4242--- local MyDecorator = require("nvim-tree.api").Decorator:extend()
43- ---
43+ ---
4444--- ---Mandatory constructor :new() will be called once per tree render, with no arguments.
4545--- function MyDecorator:new()
4646--- self.enabled = true
4747--- self.highlight_range = "name"
4848--- self.icon_placement = "after"
49- ---
49+ ---
5050--- -- create your icons and highlights once, applied to every node
5151--- self.my_icon1 = { str = "1", hl = { "DiffAdd" } }
5252--- self.my_icon2 = { str = "2", hl = { "DiffText" } }
5353--- self.my_icon_node = { str = "N", hl = { "Error" } }
5454--- self.my_highlight_group = "IncSearch"
55- ---
55+ ---
5656--- -- Define the icon signs only once
5757--- -- Only needed if you are using icon_placement = "signcolumn"
5858--- -- self:define_sign(self.my_icon1)
5959--- -- self:define_sign(self.my_icon2)
6060--- end
61- ---
61+ ---
6262--- ---Override node icon
6363--- ---@param node nvim_tree.api.Node
6464--- ---@return nvim_tree.api.highlighted_string ? icon_node
@@ -69,7 +69,7 @@ error("Cannot require a meta file")
6969--- return nil
7070--- end
7171--- end
72- ---
72+ ---
7373--- ---Return two icons for DecoratorIconPlacement "after"
7474--- ---@param node nvim_tree.api.Node
7575--- ---@return nvim_tree.api.highlighted_string[] ? icons
@@ -80,7 +80,7 @@ error("Cannot require a meta file")
8080--- return nil
8181--- end
8282--- end
83- ---
83+ ---
8484--- ---Exactly one highlight group for DecoratorHighlightRange "name"
8585--- ---@param node nvim_tree.api.Node
8686--- ---@return string ? highlight_group
@@ -91,6 +91,6 @@ error("Cannot require a meta file")
9191--- return nil
9292--- end
9393--- end
94- ---
94+ ---
9595--- return MyDecorator
9696--- ```
0 commit comments