@@ -68,18 +68,18 @@ local function log(level, component, message_parts)
68
68
end
69
69
end
70
70
71
- if level == M . levels . ERROR then
72
- vim . notify ( prefix .. " " .. message , vim . log . levels . ERROR , { title = " ClaudeCode Error " })
73
- elseif level == M . levels . WARN then
74
- vim . notify ( prefix .. " " .. message , vim . log . levels .WARN , { title = " ClaudeCode Warning " })
75
- else
76
- -- For INFO, DEBUG, TRACE, use nvim_echo to avoid flooding notifications,
77
- -- to make them appear in :messages, and wrap in vim.schedule
78
- -- to avoid "nvim_echo must not be called in a fast event context".
79
- vim . schedule ( function ()
71
+ -- Wrap all vim.notify and nvim_echo calls in vim.schedule to avoid
72
+ -- "nvim_echo must not be called in a fast event context" errors
73
+ vim . schedule ( function ()
74
+ if level == M . levels .ERROR then
75
+ vim . notify ( prefix .. " " .. message , vim . log . levels . ERROR , { title = " ClaudeCode Error " })
76
+ elseif level == M . levels . WARN then
77
+ vim . notify ( prefix .. " " .. message , vim . log . levels . WARN , { title = " ClaudeCode Warning " })
78
+ else
79
+ -- For INFO, DEBUG, TRACE, use nvim_echo to avoid flooding notifications
80
80
vim .api .nvim_echo ({ { prefix .. " " .. message , " Normal" } }, true , {})
81
- end )
82
- end
81
+ end
82
+ end )
83
83
end
84
84
85
85
--- @param component string | nil Optional component /module name.
@@ -147,3 +147,4 @@ local default_config_for_initial_setup = require("claudecode.config").defaults
147
147
M .setup (default_config_for_initial_setup )
148
148
149
149
return M
150
+
0 commit comments