@@ -219,14 +219,15 @@ function M.lsmod(modname, fn)
219
219
end )
220
220
end
221
221
222
+ --- @alias LazyNotifyOpts { lang ?: string , title ?: string , level ?: number }
223
+
222
224
--- @param msg string | string[]
223
- --- @param opts ? { lang : string , title : string }
224
- function M .notify (msg , level , opts )
225
+ --- @param opts ? LazyNotifyOpts
226
+ function M .notify (msg , opts )
225
227
if vim .in_fast_event () then
226
- vim .schedule (function ()
227
- M .notify (msg , level , opts )
228
+ return vim .schedule (function ()
229
+ M .notify (msg , opts )
228
230
end )
229
- return
230
231
end
231
232
232
233
opts = opts or {}
@@ -239,7 +240,7 @@ function M.notify(msg, level, opts)
239
240
)
240
241
end
241
242
local lang = opts .lang or " markdown"
242
- vim .notify (msg , level , {
243
+ vim .notify (msg , opts . level or vim . log . levels . INFO , {
243
244
on_open = function (win )
244
245
pcall (require , " nvim-treesitter" )
245
246
vim .wo [win ].conceallevel = 3
@@ -251,38 +252,49 @@ function M.notify(msg, level, opts)
251
252
vim .bo [buf ].syntax = lang
252
253
end
253
254
end ,
254
- title = " lazy.nvim " .. ( opts .title and " : " .. opts . title or " " ) ,
255
+ title = opts .title or " lazy.nvim " ,
255
256
})
256
257
end
257
258
258
259
--- @param msg string | string[]
259
- function M .error (msg )
260
- M .notify (msg , vim .log .levels .ERROR )
260
+ --- @param opts ? LazyNotifyOpts
261
+ function M .error (msg , opts )
262
+ opts = opts or {}
263
+ opts .level = vim .log .levels .ERROR
264
+ M .notify (msg , opts )
261
265
end
262
266
263
267
--- @param msg string | string[]
264
- function M .info (msg )
265
- M .notify (msg , vim .log .levels .INFO )
268
+ --- @param opts ? LazyNotifyOpts
269
+ function M .info (msg , opts )
270
+ opts = opts or {}
271
+ opts .level = vim .log .levels .INFO
272
+ M .notify (msg , opts )
266
273
end
267
274
268
275
--- @param msg string | string[]
269
- function M .warn (msg )
270
- M .notify (msg , vim .log .levels .WARN )
276
+ --- @param opts ? LazyNotifyOpts
277
+ function M .warn (msg , opts )
278
+ opts = opts or {}
279
+ opts .level = vim .log .levels .WARN
280
+ M .notify (msg , opts )
271
281
end
272
282
273
283
--- @param msg string | table
274
- --- @param level ? number
275
- --- @param opts ? { lang : string , title : string }
276
- function M .debug (msg , level , opts )
284
+ --- @param opts ? LazyNotifyOpts
285
+ function M .debug (msg , opts )
277
286
if not require (" lazy.core.config" ).options .debug then
278
287
return
279
288
end
280
289
opts = opts or {}
290
+ if opts .title then
291
+ opts .title = " lazy.nvim: " .. opts .title
292
+ end
281
293
if type (msg ) == " string" then
282
- M .notify (msg , level , opts )
294
+ M .notify (msg , opts )
283
295
else
284
296
opts .lang = " lua"
285
- M .notify (vim .inspect (msg ), level , opts )
297
+ M .notify (vim .inspect (msg ), opts )
286
298
end
287
299
end
288
300
0 commit comments