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
---@class CordTimestampConfig
---@field enabled? boolean Whether timestamps are enabled
---@field reset_on_idle? boolean Whether to reset timestamp when idle
---@field reset_on_change? boolean Whether to reset timestamp when changing activities
---@class CordEditorConfig
---@field client? string Editor client name, one of 'vim', 'neovim', 'lunarvim', 'nvchad', 'astronvim', 'lazyvim' or a custom Discord application ID
---@field tooltip? string Editor tooltip text
---@field icon? string Optional editor icon
---@class CordDisplayConfig
---@field theme? string Set icon theme
---@field swap_fields? boolean Whether to swap activity fields
---@field swap_icons? boolean Whether to swap activity icons
---@class CordIdleConfig
---@field enabled? boolean Whether idle detection is enabled
---@field timeout? integer Idle timeout in milliseconds
---@field show_status? boolean Whether to show idle status
---@field ignore_focus? boolean Whether to show idle when editor is focused
---@field unidle_on_focus? boolean Whether to unidle the session when editor gains focus
---@field smart_idle? boolean Whether to enable smart idle feature
---@field details? string|fun(opts: CordOpts):string Details shown when idle
---@field state? string|fun(opts: CordOpts):string State shown when idle
---@field tooltip? string|fun(opts: CordOpts):string Tooltip shown when hovering over idle icon
---@field icon? string|fun(opts: CordOpts):string Idle icon
---@class CordTextConfig
---@field workspace? string|fun(opts: CordOpts):string|boolean|nil Text for workspace activity
---@field viewing? string|fun(opts: CordOpts):string|boolean|nil Text for viewing activity
---@field editing? string|fun(opts: CordOpts):string|boolean|nil Text for editing activity
---@field file_browser? string|fun(opts: CordOpts):string|boolean|nil Text for file browser activity
---@field plugin_manager? string|fun(opts: CordOpts):string|boolean|nil Text for plugin manager activity
---@field lsp? string|fun(opts: CordOpts):string|boolean|nil Text for LSP manager activity
---@field docs? string|fun(opts: CordOpts):string|boolean|nil Text for documentation activity
---@field vcs? string|fun(opts: CordOpts):string|boolean|nil Text for VCS activity
---@field notes? string|fun(opts: CordOpts):string|boolean|nil Text for notes activity
---@field debug? string|fun(opts: CordOpts):string|boolean|nil Text for debugging-related plugin activity
---@field test? string|fun(opts: CordOpts):string|boolean|nil Text for testing-related plugin activity
---@field games? string|fun(opts: CordOpts):string|boolean|nil Text for games activity
---@field diagnostics? string|fun(opts: CordOpts):string|boolean|nil Text for diagnostics activity
---@field terminal? string|fun(opts: CordOpts):string|boolean|nil Text for terminal activity
---@field dashboard? string|fun(opts: CordOpts):string|boolean|nil Text for dashboard activity
---@class CordButtonConfig
---@field label string|fun(opts: CordOpts):string? Button label
---@field url string|fun(opts: CordOpts):string? Button URL
---@class CordAssetConfig
---@field name? string|fun(opts: CordOpts):string Asset name
---@field icon? string|fun(opts: CordOpts):string Asset icon
---@field tooltip? string|fun(opts: CordOpts):string Asset tooltip
---@field text? string|fun(opts: CordOpts):string Asset text
---@field type? string|fun(opts: CordOpts):string Asset type
---@class CordHooksConfig
---@field ready? CordReadyHook
---@field shutdown? CordShutdownHook
---@field pre_activity? CordHook
---@field post_activity? CordActivityHook
---@field idle_enter? CordHook
---@field idle_leave? CordHook
---@field workspace_change? CordHook
---@alias CordHook fun(opts: CordOpts):nil | {fun: fun(opts: CordOpts):nil, priority: number}
---@alias CordReadyHook fun(manager: ActivityManager):nil | {fun: fun(manager: ActivityManager):nil, priority: number}
---@alias CordShutdownHook fun():nil | {fun: fun():nil, priority: number}
---@alias CordActivityHook fun(opts: CordOpts, activity: Activity):nil | {fun: fun(opts: CordOpts, activity: Activity):nil, priority: number}
---@class CordPluginsConfig
---@field name string Plugin name
---@field config? table Plugin configuration
---@class CordAdvancedConfig
---@field plugin? CordAdvancedPluginConfig configuration
---@field server? CordAdvancedServerConfig configuration
---@field discord? CordAdvancedDiscordConfig configuration
---@class CordAdvancedPluginConfig
---@field autocmds? boolean Whether to enable autocmds
---@field log_level? integer Logging level (from `vim.log.levels`)
---@field cursor_update? string Cursor update mode
---@field match_in_mappings? boolean Whether to match against file extensions in mappings
---@class CordAdvancedServerConfig
---@field update? string How to acquire the server executable: 'fetch' or 'build' or 'none'
---@field pipe_path? string Path to the server's pipe
---@field executable_path? string Path to the server's executable
---@field timeout? integer Timeout in milliseconds
---@class CordAdvancedDiscordConfig
---@field reconnect? CordAdvancedDiscordReconnectConfig Reconnection configuration
---@class CordAdvancedDiscordReconnectConfig
---@field enabled? boolean Whether reconnection is enabled
---@field interval? integer Reconnection interval in milliseconds, 0 to disable
---@field initial? boolean Whether to reconnect if initial connection fails
---@alias CordVariablesConfig { [string]: string|fun(opts: CordOpts):string }
---@class CordConfig
---@field editor? CordEditorConfig Editor configuration
---@field display? CordDisplayConfig Display configuration
---@field timestamp? CordTimestampConfig Timestamp configuration
---@field idle? CordIdleConfig Idle configuration
---@field text? CordTextConfig Text configuration
---@field buttons? CordButtonConfig[] Buttons configuration
---@field assets? CordAssetConfig[] Assets configuration
---@field variables? boolean|CordVariablesConfig Variables configuration. If true, uses default options table. If table, extends default table. If false, disables custom variables.
---@field hooks? CordHooksConfig Hooks configuration
---@field plugins? string[]|CordPluginsConfig[] Plugin configuration
---@field advanced? CordAdvancedConfig Advanced configuration
---@class CordConfig
local M =
local defaults =
M. =
M. =
return setmetatable