Skip to content
This repository has been archived by the owner on Jul 6, 2021. It is now read-only.

Commit

Permalink
Merge pull request #21 from tjdevries/tjdevries/defer_fn
Browse files Browse the repository at this point in the history
fix: Make sure to schedule commands appropriately
  • Loading branch information
haorenW1025 authored May 24, 2020
2 parents 03b456e + 2d29a51 commit b10fa5c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lua/diagnostic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ function M.modifyCallback()
return
end
end

M.publish_diagnostics(bufnr)
end
end
Expand All @@ -71,7 +72,7 @@ function M.publish_diagnostics(bufnr)
if #vim.lsp.buf_get_clients() == 0 then return end
local result = M.bufferDiagnostic[bufnr]
if result == nil then return end
vim.api.nvim_command('lexpr []')
vim.fn.setloclist(0, {}, 'r')
vim.lsp.util.buf_clear_diagnostics(bufnr)
vim.lsp.util.buf_diagnostics_save_positions(bufnr, result.diagnostics)
util.buf_diagnostics_save_positions(bufnr, result.diagnostics)
Expand All @@ -83,7 +84,10 @@ function M.publish_diagnostics(bufnr)
util.buf_diagnostics_virtual_text(bufnr, result.diagnostics)
end
M.diagnostics_loclist(result)
vim.api.nvim_command("doautocmd User LspDiagnosticsChanged")

vim.schedule_wrap(function()
vim.api.nvim_command("doautocmd User LspDiagnosticsChanged")
end)
end

function M.refresh_diagnostics()
Expand Down

0 comments on commit b10fa5c

Please sign in to comment.