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

Commit bef1c61

Browse files
authored
Merge pull request #57 from erw7/fix-autocmd-change-loclist
Change call to refresh_diagnostics() to be delayed
2 parents 49abd2e + 8fa373c commit bef1c61

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

lua/diagnostic.lua

+7-1
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,12 @@ function M.refresh_diagnostics()
103103
M.publish_diagnostics(bufnr)
104104
end
105105

106+
function M.on_BufEnter()
107+
vim.schedule(function()
108+
M.refresh_diagnostics()
109+
end)
110+
end
111+
106112
function M.on_InsertLeave()
107113
M.refresh_diagnostics()
108114
end
@@ -120,7 +126,7 @@ M.on_attach = function(_, _)
120126
M.modifyCallback()
121127
vim.api.nvim_command [[augroup DiagnosticRefresh]]
122128
vim.api.nvim_command("autocmd! * <buffer>")
123-
vim.api.nvim_command [[autocmd BufEnter,BufWinEnter,TabEnter <buffer> lua require'diagnostic'.refresh_diagnostics()]]
129+
vim.api.nvim_command [[autocmd BufEnter,BufWinEnter,TabEnter <buffer> lua require'diagnostic'.on_BufEnter()]]
124130
vim.api.nvim_command [[augroup end]]
125131

126132
if vim.api.nvim_get_var('diagnostic_insert_delay') == 1 then

0 commit comments

Comments
 (0)