Skip to content

Commit 6a2d51a

Browse files
committed
Fix bug: nvim_echo must not be called in a lua loop callback
Fixes #6 Fix the 'nvim_echo must not be called in a lua loop callback' error when a break ends. * **lua/pomodoro/log.lua** - Use `vim.schedule` to call `vim.notify` in the `info` function. - Use `vim.schedule` to call `vim.notify` in the `error` function. --- For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/QuentinGruber/pomodoro.nvim/issues/6?shareId=XXXX-XXXX-XXXX-XXXX).
1 parent 9a2c33f commit 6a2d51a

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lua/pomodoro/log.lua

+7-2
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,15 @@ local log = {}
33
local p = "[pomodoro.nvim] "
44

55
function log.info(txt)
6-
vim.notify(p .. txt)
6+
vim.schedule(function()
7+
vim.notify(p .. txt)
8+
end)
79
end
810

911
function log.error(txt)
10-
vim.notify(p .. txt)
12+
vim.schedule(function()
13+
vim.notify(p .. txt)
14+
end)
1115
end
16+
1217
return log

0 commit comments

Comments
 (0)