File tree Expand file tree Collapse file tree 2 files changed +22
-13
lines changed
Expand file tree Collapse file tree 2 files changed +22
-13
lines changed Original file line number Diff line number Diff line change @@ -81,7 +81,7 @@ local function get_hex_value(name, value)
8181 })
8282
8383 if not type_ok then
84- logs .error . notify (err )
84+ logs .notify . error (err )
8585
8686 return defaults [name ]
8787 end
@@ -93,7 +93,7 @@ local function get_hex_value(name, value)
9393 local rgb = vim .api .nvim_get_color_by_name (value )
9494
9595 if rgb == - 1 then
96- logs .error . notify (" colors(%s): %q is not a valid color" , name , value )
96+ logs .notify . error (" colors(%s): %q is not a valid color" , name , value )
9797
9898 return defaults [name ]
9999 end
Original file line number Diff line number Diff line change 1+ --- @class logs
12local logs = {}
23
3- logs .error = {
4- --- Display error message.
5- ---
6- --- NOTE: This function receives params that will be passed to `string.format`.
7- --- @param s string
8- --- @param ... any
9- notify = function (s , ...)
10- local message = string.format (s , ... )
4+ --- Display a notification to the user
5+ --- @param log_level string
6+ --- @param s string
7+ local function notify (log_level , s , ...)
8+ local message = string.format (s , ... )
119
12- vim .notify_once (message , vim .log .levels .ERROR , {
13- title = " One Monokai" ,
14- })
10+ vim .notify_once (message , log_level , {
11+ title = " One Monokai" ,
12+ })
13+ end
14+
15+ --- @class notify
16+ --- @field error fun ( s : string , ... ) #Show error message
17+ --- @field warning fun ( s : string , ... ) #Show warning message
18+ logs .notify = {
19+ error = function (s , ...)
20+ notify (vim .log .levels .ERROR , s , ... )
21+ end ,
22+ warning = function (s , ...)
23+ notify (vim .log .levels .WARNING , s , ... )
1524 end ,
1625}
1726
You can’t perform that action at this time.
0 commit comments