Skip to content

Commit 613ccc1

Browse files
committed
standardise on '---@param'
1 parent 36cfa67 commit 613ccc1

File tree

9 files changed

+73
-73
lines changed

9 files changed

+73
-73
lines changed

lua/nvim-tree/renderer/builder.lua

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ local notify = require "nvim-tree.notify"
44
local pad = require "nvim-tree.renderer.components.padding"
55
local icons = require "nvim-tree.renderer.components.icons"
66

7-
--- @class Builder
8-
--- @field private index number
9-
--- @field private depth number
10-
--- @field private highlights table[] hl_group, line, col_start, col_end arguments for vim.api.nvim_buf_add_highlight
11-
--- @field private lines string[] includes icons etc.
12-
--- @field private markers boolean[] indent markers
13-
--- @field private sign_names string[] line signs
14-
--- @field private root_cwd string absolute path
15-
--- @field private decorators Decorator[] in priority order
7+
---@class Builder
8+
---@field private index number
9+
---@field private depth number
10+
---@field private highlights table[] hl_group, line, col_start, col_end arguments for vim.api.nvim_buf_add_highlight
11+
---@field private lines string[] includes icons etc.
12+
---@field private markers boolean[] indent markers
13+
---@field private sign_names string[] line signs
14+
---@field private root_cwd string absolute path
15+
---@field private decorators Decorator[] in priority order
1616
local Builder = {}
1717
Builder.__index = Builder
1818

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ local ICON_PLACEMENT = require("nvim-tree.enum").ICON_PLACEMENT
55

66
local Decorator = require "nvim-tree.renderer.decorator"
77

8-
--- @class DecoratorBookmarks: Decorator
9-
--- @field icon HighlightedString
8+
---@class DecoratorBookmarks: Decorator
9+
---@field icon HighlightedString
1010
local DecoratorBookmarks = Decorator:new()
1111

12-
--- @param opts table
13-
--- @return DecoratorBookmarks
12+
---@param opts table
13+
---@return DecoratorBookmarks
1414
function DecoratorBookmarks:new(opts)
1515
local o = Decorator.new(self, {
1616
enabled = true,

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ local ICON_PLACEMENT = require("nvim-tree.enum").ICON_PLACEMENT
55

66
local Decorator = require "nvim-tree.renderer.decorator"
77

8-
--- @class DecoratorCopied: Decorator
9-
--- @field enabled boolean
10-
--- @field icon HighlightedString|nil
8+
---@class DecoratorCopied: Decorator
9+
---@field enabled boolean
10+
---@field icon HighlightedString|nil
1111
local DecoratorCopied = Decorator:new()
1212

13-
--- @param opts table
14-
--- @return DecoratorCopied
13+
---@param opts table
14+
---@return DecoratorCopied
1515
function DecoratorCopied:new(opts)
1616
local o = Decorator.new(self, {
1717
enabled = true,

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ local ICON_PLACEMENT = require("nvim-tree.enum").ICON_PLACEMENT
55

66
local Decorator = require "nvim-tree.renderer.decorator"
77

8-
--- @class DecoratorCut: Decorator
9-
--- @field enabled boolean
10-
--- @field icon HighlightedString|nil
8+
---@class DecoratorCut: Decorator
9+
---@field enabled boolean
10+
---@field icon HighlightedString|nil
1111
local DecoratorCut = Decorator:new()
1212

13-
--- @param opts table
14-
--- @return DecoratorCut
13+
---@param opts table
14+
---@return DecoratorCut
1515
function DecoratorCut:new(opts)
1616
local o = Decorator.new(self, {
1717
enabled = true,

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ local ICON_KEYS = {
3030
["hint"] = vim.diagnostic.severity.HINT,
3131
}
3232

33-
--- @class DecoratorDiagnostics: Decorator
34-
--- @field icons HighlightedString[]
33+
---@class DecoratorDiagnostics: Decorator
34+
---@field icons HighlightedString[]
3535
local DecoratorDiagnostics = Decorator:new()
3636

37-
--- @param opts table
38-
--- @return DecoratorDiagnostics
37+
---@param opts table
38+
---@return DecoratorDiagnostics
3939
function DecoratorDiagnostics:new(opts)
4040
local o = Decorator.new(self, {
4141
enabled = opts.diagnostics.enable,

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

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ local ICON_PLACEMENT = require("nvim-tree.enum").ICON_PLACEMENT
66

77
local Decorator = require "nvim-tree.renderer.decorator"
88

9-
--- @class HighlightedStringGit: HighlightedString
10-
--- @field ord number decreasing priority
11-
12-
--- @class DecoratorGit: Decorator
13-
--- @field file_hl table<string, string> by porcelain status e.g. "AM"
14-
--- @field folder_hl table<string, string> by porcelain status
15-
--- @field icons_by_status HighlightedStringGit[] by human status
16-
--- @field icons_by_xy table<string, HighlightedStringGit[]> by porcelain status
9+
---@class HighlightedStringGit: HighlightedString
10+
---@field ord number decreasing priority
11+
12+
---@class DecoratorGit: Decorator
13+
---@field file_hl table<string, string> by porcelain status e.g. "AM"
14+
---@field folder_hl table<string, string> by porcelain status
15+
---@field icons_by_status HighlightedStringGit[] by human status
16+
---@field icons_by_xy table<string, HighlightedStringGit[]> by porcelain status
1717
local DecoratorGit = Decorator:new()
1818

19-
--- @param opts table
20-
--- @return DecoratorGit
19+
---@param opts table
20+
---@return DecoratorGit
2121
function DecoratorGit:new(opts)
2222
local o = Decorator.new(self, {
2323
enabled = opts.git.enable,
@@ -46,7 +46,7 @@ function DecoratorGit:new(opts)
4646
return o
4747
end
4848

49-
--- @param glyphs table<string, string> user glyps
49+
---@param glyphs table<string, string> user glyps
5050
function DecoratorGit:build_icons_by_status(glyphs)
5151
self.icons_by_status = {
5252
staged = { str = glyphs.staged, hl = { "NvimTreeGitStagedIcon" }, ord = 1 },
@@ -138,8 +138,8 @@ function DecoratorGit:build_hl_table()
138138
end
139139

140140
--- Git icons: git.enable, renderer.icons.show.git and node has status
141-
--- @param node table
142-
--- @return HighlightedString[]|nil modified icon
141+
---@param node table
142+
---@return HighlightedString[]|nil modified icon
143143
function DecoratorGit:calculate_icons(node)
144144
if not node or not self.enabled or not self.icons_by_xy then
145145
return nil

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

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
local HL_POSITION = require("nvim-tree.enum").HL_POSITION
22
local ICON_PLACEMENT = require("nvim-tree.enum").ICON_PLACEMENT
33

4-
--- @class Decorator
5-
--- @field protected enabled boolean
6-
--- @field protected hl_pos HL_POSITION
7-
--- @field protected icon_placement ICON_PLACEMENT
4+
---@class Decorator
5+
---@field protected enabled boolean
6+
---@field protected hl_pos HL_POSITION
7+
---@field protected icon_placement ICON_PLACEMENT
88
local Decorator = {}
99

10-
--- @param o Decorator|nil
11-
--- @return Decorator
10+
---@param o Decorator|nil
11+
---@return Decorator
1212
function Decorator:new(o)
1313
o = o or {}
1414
setmetatable(o, self)
@@ -18,9 +18,9 @@ function Decorator:new(o)
1818
end
1919

2020
--- Maybe highlight groups
21-
--- @param node table
22-
--- @return string|nil icon highlight group
23-
--- @return string|nil name highlight group
21+
---@param node table
22+
---@return string|nil icon highlight group
23+
---@return string|nil name highlight group
2424
function Decorator:groups_icon_name(node)
2525
local icon_hl, name_hl
2626

@@ -39,8 +39,8 @@ function Decorator:groups_icon_name(node)
3939
end
4040

4141
--- Maybe icon sign
42-
--- @param node table
43-
--- @return string|nil name
42+
---@param node table
43+
---@return string|nil name
4444
function Decorator:sign_name(node)
4545
if not self.enabled or self.icon_placement ~= ICON_PLACEMENT.signcolumn then
4646
return
@@ -53,8 +53,8 @@ function Decorator:sign_name(node)
5353
end
5454

5555
--- Icons when ICON_PLACEMENT.before
56-
--- @param node table
57-
--- @return HighlightedString[]|nil icons
56+
---@param node table
57+
---@return HighlightedString[]|nil icons
5858
function Decorator:icons_before(node)
5959
if not self.enabled or self.icon_placement ~= ICON_PLACEMENT.before then
6060
return
@@ -64,8 +64,8 @@ function Decorator:icons_before(node)
6464
end
6565

6666
--- Icons when ICON_PLACEMENT.after
67-
--- @param node table
68-
--- @return HighlightedString[]|nil icons
67+
---@param node table
68+
---@return HighlightedString[]|nil icons
6969
function Decorator:icons_after(node)
7070
if not self.enabled or self.icon_placement ~= ICON_PLACEMENT.after then
7171
return
@@ -75,24 +75,24 @@ function Decorator:icons_after(node)
7575
end
7676

7777
--- Maybe icons, optionally implemented
78-
--- @protected
79-
--- @param _ table node
80-
--- @return HighlightedString[]|nil icons
78+
---@protected
79+
---@param _ table node
80+
---@return HighlightedString[]|nil icons
8181
function Decorator:calculate_icons(_)
8282
return nil
8383
end
8484

8585
--- Maybe highlight group, optionally implemented
86-
--- @protected
87-
--- @param _ table node
88-
--- @return string|nil group
86+
---@protected
87+
---@param _ table node
88+
---@return string|nil group
8989
function Decorator:calculate_highlight(_)
9090
return nil
9191
end
9292

9393
--- Define a sign
94-
--- @protected
95-
--- @param icon HighlightedString|nil
94+
---@protected
95+
---@param icon HighlightedString|nil
9696
function Decorator:define_sign(icon)
9797
if icon and #icon.hl > 0 then
9898
local name = icon.hl[1]

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ local ICON_PLACEMENT = require("nvim-tree.enum").ICON_PLACEMENT
55

66
local Decorator = require "nvim-tree.renderer.decorator"
77

8-
--- @class DecoratorModified: Decorator
9-
--- @field icon HighlightedString|nil
8+
---@class DecoratorModified: Decorator
9+
---@field icon HighlightedString|nil
1010
local DecoratorModified = Decorator:new()
1111

12-
--- @param opts table
13-
--- @return DecoratorModified
12+
---@param opts table
13+
---@return DecoratorModified
1414
function DecoratorModified:new(opts)
1515
local o = Decorator.new(self, {
1616
enabled = opts.modified.enable,

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ local ICON_PLACEMENT = require("nvim-tree.enum").ICON_PLACEMENT
55

66
local Decorator = require "nvim-tree.renderer.decorator"
77

8-
--- @class DecoratorOpened: Decorator
9-
--- @field enabled boolean
10-
--- @field icon HighlightedString|nil
8+
---@class DecoratorOpened: Decorator
9+
---@field enabled boolean
10+
---@field icon HighlightedString|nil
1111
local DecoratorOpened = Decorator:new()
1212

13-
--- @param opts table
14-
--- @return DecoratorOpened
13+
---@param opts table
14+
---@return DecoratorOpened
1515
function DecoratorOpened:new(opts)
1616
local o = Decorator.new(self, {
1717
enabled = true,
@@ -24,7 +24,7 @@ function DecoratorOpened:new(opts)
2424
end
2525

2626
--- Opened highlight: renderer.highlight_opened_files and node has an open buffer
27-
--- @param node table
27+
---@param node table
2828
function DecoratorOpened:calculate_highlight(node)
2929
if self.hl_pos ~= HL_POSITION.none and buffers.is_opened(node) then
3030
return "NvimTreeOpenedHL"

0 commit comments

Comments
 (0)