File tree Expand file tree Collapse file tree 2 files changed +11
-2
lines changed
test/spec/builtins/diagnostics Expand file tree Collapse file tree 2 files changed +11
-2
lines changed Original file line number Diff line number Diff line change 80
80
--- @param msg any
81
81
function log :warn (msg )
82
82
self :add_entry (msg , " warn" )
83
- vim .notify (self .__notify_fmt (msg ), vim .log .levels .WARN , default_notify_opts )
83
+ vim .schedule (function ()
84
+ vim .notify (self .__notify_fmt (msg ), vim .log .levels .WARN , default_notify_opts )
85
+ end )
84
86
end
85
87
86
88
--- Add a log entry at ERROR level
87
89
--- @param msg any
88
90
function log :error (msg )
89
91
self :add_entry (msg , " error" )
90
- vim .notify (self .__notify_fmt (msg ), vim .log .levels .ERROR , default_notify_opts )
92
+ vim .schedule (function ()
93
+ vim .notify (self .__notify_fmt (msg ), vim .log .levels .ERROR , default_notify_opts )
94
+ end )
91
95
end
92
96
93
97
setmetatable ({}, log )
Original file line number Diff line number Diff line change @@ -7,6 +7,10 @@ stub(vim, "notify")
7
7
describe (" diagnostics regal" , function ()
8
8
local parser = diagnostics .regal ._opts .on_output
9
9
10
+ local wait_for_scheduler = function ()
11
+ vim .wait (0 )
12
+ end
13
+
10
14
it (" should create a diagnostic with error severity" , function ()
11
15
local output = vim .json .decode ([[
12
16
{
@@ -62,6 +66,7 @@ describe("diagnostics regal", function()
62
66
it (" should log error for non-json output" , function ()
63
67
local diagnostic = parser ({ output = " non-json-output" , err = " json error" })
64
68
assert .same ({}, diagnostic )
69
+ wait_for_scheduler ()
65
70
assert
66
71
.stub (vim .notify )
67
72
.was_called_with (" [null-ls] non-json-output" , vim .log .levels .ERROR , { title = " null-ls" })
You can’t perform that action at this time.
0 commit comments