forked from akinsho/bufferline.nvim
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtypes.lua
More file actions
229 lines (199 loc) · 9.17 KB
/
Copy pathtypes.lua
File metadata and controls
229 lines (199 loc) · 9.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
---@meta _
---@class bufferline.DebugOpts
---@field logging boolean
---@class bufferline.GroupOptions
---@field toggle_hidden_on_enter boolean re-open hidden groups on bufenter
---@class bufferline.GroupOpts
---@field options bufferline.GroupOptions
---@field items bufferline.Group[]
---@class bufferline.Indicator
---@field style "underline" | "icon" | "none"
---@field icon string?
---@alias bufferline.Mode 'tabs' | 'buffers'
---@alias bufferline.DiagnosticIndicator fun(count: number, level: number, errors: table<string, any>, ctx: table<string, any>): string
---@alias bufferline.HoverOptions {reveal: string[], delay: integer, enabled: boolean}
---@alias bufferline.IconFetcherOpts {directory: boolean, path: string, extension: string, filetype: string?}
---@class bufferline.Options
---@field public mode bufferline.Mode
---@field public style_preset bufferline.StylePreset | bufferline.StylePreset[]
---@field public view string
---@field public debug bufferline.DebugOpts
---@field public numbers string | fun(ordinal: number, id: number, lower: number_helper, raise: number_helper): string
---@field public buffer_close_icon string
---@field public modified_icon string
---@field public close_icon string
---@field public close_command string | function
---@field public custom_filter fun(buf: number, bufnums: number[]): boolean
---@field public left_mouse_command string | function
---@field public right_mouse_command string | function
---@field public middle_mouse_command (string | function)?
---@field public indicator bufferline.Indicator
---@field public left_trunc_marker string
---@field public right_trunc_marker string
---@field public separator_style string | {[1]: string, [2]: string}
---@field public name_formatter (fun(path: string):string)?
---@field public tab_size number
---@field public truncate_names boolean
---@field public max_name_length number
---@field public color_icons boolean
---@field public show_buffer_icons boolean
---@field public show_buffer_close_icons boolean
---@field public show_buffer_default_icon boolean
---@field public get_element_icon fun(opts: bufferline.IconFetcherOpts): string?, string?
---@field public show_close_icon boolean
---@field public show_tab_indicators boolean
---@field public show_duplicate_prefix boolean
---@field public enforce_regular_tabs boolean
---@field public always_show_bufferline boolean
---@field public persist_buffer_sort boolean
---@field public move_wraps_at_ends boolean
---@field public max_prefix_length number
---@field public sort_by string
---@field public diagnostics boolean | 'nvim_lsp' | 'coc'
---@field public diagnostics_indicator bufferline.DiagnosticIndicator
---@field public diagnostics_update_in_insert boolean
---@field public offsets table[]
---@field public groups bufferline.GroupOpts
---@field public themable boolean
---@field public hover bufferline.HoverOptions
---@class bufferline.HLGroup
---@field fg string
---@field bg string
---@field sp string
---@field special string
---@field bold boolean
---@field italic boolean
---@field underline boolean
---@field undercurl boolean
---@field hl_group string
---@field hl_name string
---@alias bufferline.Highlights table<string, bufferline.HLGroup>
---@class bufferline.UserConfig
---@field public options bufferline.Options
---@field public highlights bufferline.Highlights | fun(BufferlineHighlights): bufferline.Highlights
---@class bufferline.Config
---@field public options bufferline.Options
---@field public highlights bufferline.Highlights
---@field user bufferline.UserConfig original copy of user preferences
---@field merge fun(self: bufferline.Config, defaults: bufferline.Config): bufferline.Config
---@field validate fun(self: bufferline.Config, defaults: bufferline.Config, resolved: bufferline.Highlights): nil
---@field resolve fun(self: bufferline.Config, defaults: bufferline.Config): bufferline.Config
---@field is_tabline fun(self: bufferline.Config):boolean
--- @alias bufferline.Visibility 1 | 2 | 3
--- @alias bufferline.Duplicate "path" | "element" | nil
---@class bufferline.Component
---@field name string?
---@field id integer
---@field path string?
---@field length integer
---@field component fun(BufferlineState): bufferline.Segment[]
---@field hidden boolean
---@field focusable boolean
---@field type 'group_end' | 'group_start' | 'buffer' | 'tabpage'
---@generic T
---@alias bufferline.AncestorSearch fun(self: T, depth: integer, formatter: (fun(string, integer): string)?): string
---@alias bufferline.TabElement bufferline.Tab|bufferline.Buffer
---@class bufferline.Tab
---@field public id integer
---@field public buf integer
---@field public icon string
---@field public name string
---@field public group string
---@field public letter string
---@field public modified boolean
---@field public modifiable boolean
---@field public duplicated bufferline.Duplicate
---@field public extension string the file extension
---@field public path string the full path to the file
---@field public visibility fun(self: bufferline.Tab): integer
---@field public current fun(self: bufferline.Tab): boolean
---@field public visible fun(self: bufferline.Tab): boolean
---@field public ancestor bufferline.AncestorSearch
---@field public __ancestor bufferline.AncestorSearch
-- A single buffer class
-- this extends the [Component] class
---@class bufferline.Buffer
---@field public extension string the file extension
---@field public path string the full path to the file
---@field public name_formatter function? dictates how the name should be shown
---@field public id integer the buffer number
---@field public name string the visible name for the file
---@field public filename string
---@field public icon string the icon
---@field public icon_highlight string?
---@field public diagnostics table
---@field public modified boolean
---@field public modifiable boolean
---@field public buftype string
---@field public letter string?
---@field public ordinal integer
---@field public duplicated bufferline.Duplicate
---@field public prefix_count integer
---@field public component BufferComponent
---@field public group string?
---@field public group_fn string
---@field public length integer the length of the buffer component
---@field public visibility fun(self: bufferline.Buffer): integer
---@field public current fun(self: bufferline.Buffer): boolean
---@field public visible fun(self: bufferline.Buffer): boolean
---@field public ancestor bufferline.AncestorSearch
---@field public __ancestor bufferline.AncestorSearch
---@field public find_index fun(Buffer, BufferlineState): integer?
---@field public newly_opened fun(Buffer, BufferlineState): boolean
---@field public previously_opened fun(Buffer, BufferlineState): boolean
---@alias bufferline.ComponentsByGroup (bufferline.Group | bufferline.Component[])[]
--- @class bufferline.GroupState
--- @field manual_groupings table<number, string>
--- @field user_groups table<string, bufferline.Group>
--- @field components_by_group bufferline.ComponentsByGroup
--- @class bufferline.Separators
--- @field sep_start bufferline.Segment[]
--- @field sep_end bufferline.Segment[]
---@alias GroupSeparator fun(group:bufferline.Group, hls: bufferline.HLGroup, count_item: string?): bufferline.Separators
---@alias GroupSeparators table<string, GroupSeparator>
---@class bufferline.Group
---@field public id string used for identifying the group in the tabline
---@field public name string 'formatted name of the group'
---@field public display_name string original name including special characters
---@field public matcher fun(b: bufferline.Buffer): boolean?
---@field public separator GroupSeparators
---@field public priority number
---@field public highlight table<string, string>
---@field public icon string
---@field public hidden boolean
---@field public with fun(Group, Group): bufferline.Group
---@field auto_close boolean when leaving the group automatically close it
---@class bufferline.RenderContext
---@field preferences bufferline.Config
---@field current_highlights {[string]: string}
---@field tab bufferline.TabElement
---@field is_picking boolean
---@class bufferline.SegmentAttribute
---@field global boolean whether or not the attribute applies to other elements apart from the current one
---@field prefix string
---@field suffix string
---@field extends number how many positions the attribute extends for
---@class bufferline.Segment
---@field text string
---@field highlight string
---@field attr bufferline.SegmentAttribute
---@class bufferline.Section
---@field items bufferline.Component[]
---@field length integer
---@field drop fun(self: bufferline.Section, count: integer): bufferline.Section?
---@field add fun(self: bufferline.Section, item: bufferline.Component)
---@class bufferline.State
---@field components bufferline.Component[]
---@field current_element_index number?
---@field is_picking boolean
---@field visible_components bufferline.Component[]
---@field __components bufferline.Component[]
---@field custom_sort number[]?
---@field left_offset_size number
---@field right_offset_size number
---@alias bufferline.Sorter fun(buf_a: bufferline.Buffer, buf_b: bufferline.Buffer): boolean
---@class bufferline.SorterOptions
---@field sort_by (string|function)?
---@field current_index integer?
---@field custom_sort boolean?
---@field prev_components bufferline.TabElement[]