Skip to content

Commit f46958a

Browse files
committed
doc(core): Updated type definitions
1 parent 2a84411 commit f46958a

File tree

5 files changed

+311
-48
lines changed

5 files changed

+311
-48
lines changed

lua/definitions/bars.lua

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
---@meta
2+
13
--- Primary configuration table.
24
---@class bars.config
35
---
@@ -8,8 +10,8 @@
810
--- opening Neovim or new windows.
911
---@field global? boolean
1012
---
11-
---@field statusline? statusline.config Statusline configuration.
12-
---@field statuscolumn? statuscolumn.config Statuscolumn configuration.
13-
---@field winbar? winbar.config Winbar configuration.
13+
---@field statusline? boolean | statusline.config Statusline configuration.
14+
---@field statuscolumn? boolean | statuscolumn.config Statuscolumn configuration.
15+
---@field winbar? boolean | winbar.config Winbar configuration.
1416
---
15-
---@field tabline? tabline.config Tabline configuration.
17+
---@field tabline? boolean | tabline.config Tabline configuration.

lua/definitions/statuscolumn.lua

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@
66
--- Is the module enabled?
77
---@field enable boolean
88
---
9+
--- State for attached windows,
10+
--- true -> Enabled(should be rendered).
11+
--- false -> Attached but disabled.
12+
---
913
---@field attached_windows table<integer, boolean>
1014

1115
-----------------------------------------------------------------------------
@@ -28,6 +32,7 @@
2832
--- Configuration style.
2933
---@field [string] statuscolumn.style
3034

35+
3136
--- A configuration style.
3237
--- Must have a condition(unless `default`)
3338
--- and a list of parts.
@@ -38,12 +43,14 @@
3843
--- Parts for this style.
3944
---@field parts statuscolumn_part[]
4045

46+
4147
---@alias statuscolumn_part
4248
---| statuscolumn.parts.lnum Line number.
4349
---| statuscolumn.parts.folds Fold column.
4450
---| statuscolumn.parts.signs Sign column.
4551
---| statuscolumn.parts.empty An empty column.
4652
---| statuscolumn.parts.border A statuscolumn border.
53+
---| statuscolumn.parts.custom
4754

4855
-----------------------------------------------------------------------------
4956

@@ -53,7 +60,8 @@
5360
--- Condition for this component.
5461
---@field condition? fun(buffer: integer, window: integer, statuscolumn: string): boolean
5562
---
56-
---@field kind "lnum" What kind of part is this?
63+
--- What kind of part is this?
64+
---@field kind "lnum"
5765
---
5866
---@field click? boolean | fun(buffer: integer, window: integer, statuscolumn: string): boolean
5967
---
@@ -105,7 +113,7 @@
105113
--- Condition for this component.
106114
---@field condition? fun(buffer: integer, window: integer, statuscolumn: string): boolean
107115
---
108-
--- What kind of component is this?
116+
--- What kind of part is this?
109117
---@field kind "border"
110118
---
111119
--- Text to use for the border.
@@ -123,7 +131,7 @@
123131
--- Condition for this component.
124132
---@field condition? fun(buffer: integer, window: integer, statuscolumn: string): boolean
125133
---
126-
--- What kind of component is this?
134+
--- What kind of part is this?
127135
---@field kind "folds"
128136
---
129137
--- Text to show for closed fold.
@@ -188,7 +196,7 @@
188196
--- Condition for this component.
189197
---@field condition? fun(buffer: integer, window: integer, statuscolumn: string): boolean
190198
---
191-
--- What kind of component is this?
199+
--- What kind of part is this?
192200
---@field kind "signs"
193201
---
194202
--- Filter for signs.
@@ -200,4 +208,16 @@
200208
---@field hl? string
201209

202210

211+
--- Custom part for the statuscolumn.
212+
---@class statuscolumn.parts.custom
213+
---
214+
--- Condition for this component.
215+
---@field condition? fun(buffer: integer, window: integer, statuscolumn: string): boolean
216+
---
217+
--- What kind of part is this?
218+
---@field kind "custom"
219+
---
220+
--- Text to render.
221+
---@field value string | fun(buffer: integer, window: integer, statuscolumn: string): string
222+
203223

lua/definitions/statusline.lua

Lines changed: 43 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
--- Should we attach to new windows?
88
---@field enable boolean
99
---
10-
--- List of attached windows.
10+
--- State of attached windows.
11+
--- true -> Attached & rendering.
12+
--- false -> Attached only.
1113
---@field attached_windows table<integer, boolean>
1214

1315
-----------------------------------------------------------------------------
@@ -37,16 +39,17 @@
3739
---| statusline.parts.diagnostics
3840
---| statusline.parts.branch
3941
---| statusline.parts.bufname
42+
---| statusline.parts.custom
4043

4144
-----------------------------------------------------------------------------
4245

4346
--- Shows current git branch.
4447
---@class statusline.parts.branch
4548
---
46-
--- Optional condition for this component.
49+
--- Optional condition for this part.
4750
---@field condition? boolean | fun(buffer: integer, window: integer): boolean
4851
---
49-
--- What kind of component is this?
52+
--- What kind of part is this?
5053
---@field kind "branch"
5154
---
5255
--- Delay(in milliseconds) between branch
@@ -61,7 +64,7 @@
6164
---@field [string] branch.opts
6265

6366

64-
--- Git branch component options.
67+
--- Git branch part options.
6568
--- Drawn like so,
6669
---
6770
---```txt
@@ -100,10 +103,10 @@
100103
--- Shows buffer name.
101104
---@class statusline.parts.bufname
102105
---
103-
--- Optional condition for this component.
106+
--- Optional condition for this part.
104107
---@field condition? boolean | fun(buffer: integer, window: integer): boolean
105108
---
106-
--- What kind of component is this?
109+
--- What kind of part is this?
107110
---@field kind "bufname"
108111
---
109112
--- Maximum name length.
@@ -116,7 +119,7 @@
116119
---@field [string] bufname.opts
117120

118121

119-
--- Buffer name component options.
122+
--- Buffer name part options.
120123
--- Drawn like so,
121124
---
122125
---```txt
@@ -161,15 +164,15 @@
161164
--- Shows diagnostics count.
162165
---@class statusline.parts.diagnostics
163166
---
164-
--- Optional condition for this component.
167+
--- Optional condition for this part.
165168
---@field condition? boolean | fun(buffer: integer, window: integer): boolean
166169
---
167-
--- What kind of component is this?
170+
--- What kind of part is this?
168171
---@field kind "diagnostics"
169172
---
170-
--- Should this component be automatically hidden?
173+
--- Should this part be automatically hidden?
171174
---
172-
--- > This component gets hidden if a buffer has
175+
--- > This part gets hidden if a buffer has
173176
--- > no client attached to it.
174177
---@field auto_hide? boolean
175178
---
@@ -211,48 +214,48 @@
211214
--- Highlight group for the separator.
212215
---@field separator_hl? string
213216
---
214-
--- Left corner of the component.
217+
--- Left corner of the part.
215218
---@field corner_left? string
216219
---@field corner_left_hl? string
217220
---
218-
--- Left padding of the component.
221+
--- Left padding of the part.
219222
---@field padding_left? string
220223
---@field padding_left_hl? string
221224
---
222-
--- Right padding of the component.
225+
--- Right padding of the part.
223226
---@field padding_right? string
224227
---@field padding_right_hl? string
225228
---
226-
--- Right corner of the component.
229+
--- Right corner of the part.
227230
---@field corner_right? string
228231
---@field corner_right_hl? string
229232
---
230-
--- Primary highlight group for the component
233+
--- Primary highlight group for the part
231234
---@field hl? string
232235

233236
-----------------------------------------------------------------------------
234237

235238
--- Empty space.
236239
---@class statusline.parts.empty
237240
---
238-
--- Optional condition for this component.
241+
--- Optional condition for this part.
239242
---@field condition? boolean | fun(buffer: integer, window: integer): boolean
240243
---
241-
--- What kind of component is this?
244+
--- What kind of part is this?
242245
---@field kind "empty"
243246
---
244-
--- Highlight group for this component.
247+
--- Highlight group for this part.
245248
---@field hl? string
246249

247250
-----------------------------------------------------------------------------
248251

249252
--- Shows current mode.
250253
---@class statusline.parts.mode
251254
---
252-
--- Optional condition for this component.
255+
--- Optional condition for this part.
253256
---@field condition? boolean | fun(buffer: integer, window: integer): boolean
254257
---
255-
--- What kind of component is this?
258+
--- What kind of part is this?
256259
---@field kind "mode"
257260
---
258261
--- Should we show a compact version?
@@ -262,7 +265,7 @@
262265
---@field [string] mode.opts
263266

264267

265-
--- Mode name component options.
268+
--- Mode name part options.
266269
--- Drawn like so,
267270
---
268271
---```txt
@@ -311,10 +314,10 @@
311314
--- └ corner_left
312315
---@class statusline.parts.section
313316
---
314-
--- Condition for this component.
317+
--- Condition for this part.
315318
---@field condition? fun(buffer: integer, window: integer): boolean
316319
---
317-
--- What kind of component is this?
320+
--- What kind of part is this?
318321
---@field kind? "section"
319322
---
320323
--- Reference to a click handler.
@@ -346,10 +349,10 @@
346349
--- Custom ruler.
347350
---@class statusline.parts.ruler
348351
---
349-
--- Optional condition for this component.
352+
--- Optional condition for this part.
350353
---@field condition? boolean | fun(buffer: integer, window: integer): boolean
351354
---
352-
--- What kind of component is this?
355+
--- What kind of part is this?
353356
---@field kind "ruler"
354357
---
355358
--- Should visual modes be shown
@@ -365,7 +368,7 @@
365368
---@field visual ruler.opts
366369

367370

368-
--- Ruler component options.
371+
--- Ruler part options.
369372
--- Drawn like so,
370373
---
371374
---```txt
@@ -402,3 +405,16 @@
402405
--- Primary highlight group.
403406
---@field hl? string
404407

408+
409+
--- Custom statusline part.
410+
---@class statusline.parts.custom
411+
---
412+
--- Optional condition for this part.
413+
---@field condition? boolean | fun(buffer: integer, window: integer): boolean
414+
---
415+
--- What kind of part is this?
416+
---@field kind "ruler"
417+
---
418+
--- Text to show for this part.
419+
---@field value fun(buffer: integer, window: integer): string
420+

0 commit comments

Comments
 (0)