Skip to content

Commit 3c90274

Browse files
committed
fix(lsp): schedule notifications
1 parent 4f26911 commit 3c90274

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

lua/haskell-tools/lsp/init.lua

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,9 @@ Hls.load_hls_settings = function(project_root, opts)
9494
if not success then
9595
local msg = 'Could not decode ' .. settings_json .. '. Falling back to default settings.'
9696
log.warn { msg, error }
97-
vim.notify('haskell-tools.lsp: ' .. msg, vim.log.levels.WARN)
97+
vim.schedule(function()
98+
vim.notify('haskell-tools.lsp: ' .. msg, vim.log.levels.WARN)
99+
end)
98100
return default_settings
99101
end
100102
log.debug { 'hls settings', settings }
@@ -139,7 +141,9 @@ Hls.start = function(bufnr)
139141
if not ok then
140142
---@cast err string
141143
log.error { 'on_attach failed', err }
142-
vim.notify('haskell-tools.lsp: Error in hls.on_attach: ' .. err)
144+
vim.schedule(function()
145+
vim.notify('haskell-tools.lsp: Error in hls.on_attach: ' .. err)
146+
end)
143147
end
144148
local function buf_refresh_codeLens()
145149
vim.schedule(function()
@@ -210,7 +214,9 @@ Hls.restart = function(bufnr)
210214
timer:stop()
211215
attempts_to_live = 0
212216
elseif attempts_to_live <= 0 then
217+
vim.schedule(function()
213218
vim.notify('haslell-tools.lsp: Could not restart all LSP clients.', vim.log.levels.ERROR)
219+
end)
214220
timer:stop()
215221
attempts_to_live = 0
216222
end

0 commit comments

Comments
 (0)