From eca5f6e5c8f08f6c6aa406242cea2dc5e6637310 Mon Sep 17 00:00:00 2001 From: Andreas Johansson Date: Tue, 30 Jun 2020 09:12:52 +0200 Subject: [PATCH] Extract the changed event into a module function --- lua/diagnostic.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lua/diagnostic.lua b/lua/diagnostic.lua index 7555bcb..baa6148 100644 --- a/lua/diagnostic.lua +++ b/lua/diagnostic.lua @@ -87,11 +87,12 @@ function M.publish_diagnostics(bufnr) util.buf_diagnostics_virtual_text(bufnr, result.diagnostics) end M.diagnostics_loclist(result) + M.trigger_diagnostics_changed() +end - vim.schedule_wrap(function() +M.trigger_diagnostics_changed = vim.schedule_wrap(function() vim.api.nvim_command("doautocmd User LspDiagnosticsChanged") - end)() -end +end) function M.refresh_diagnostics() local bufnr = vim.api.nvim_win_get_buf(0)