Skip to content

Commit

Permalink
Defer notify to the main loop to prevent neovim throwing errors
Browse files Browse the repository at this point in the history
  • Loading branch information
MarkusPettersson98 committed Nov 25, 2024
1 parent 13b4f37 commit 85384f2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lua/rustaceanvim/lsp/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -317,10 +317,14 @@ M.set_target_arch = function(bufnr, target)
ra.cargo = ra.cargo or {} -- Initialize the cargo subkey if necessary
ra.cargo.target = target
client.notify('workspace/didChangeConfiguration', { settings = client.config.settings })
vim.notify('Target architecture updated successfully to: ' .. target, vim.log.levels.INFO)
vim.schedule(function()
vim.notify('Target architecture updated successfully to: ' .. target, vim.log.levels.INFO)
end)
return
else
vim.notify('Invalid target architecture provided: ' .. tostring(target), vim.log.levels.ERROR)
vim.schedule(function()
vim.notify('Invalid target architecture provided: ' .. tostring(target), vim.log.levels.ERROR)
end)
return
end
end)
Expand Down

0 comments on commit 85384f2

Please sign in to comment.