# HG changeset patch # User Zeger Van de Vannet # Date 1616172902 -3600 # Node ID f300ef1bc475721c954179ec10e73dd545f07c85 # Parent db80c8ac727d84c785b56ce2a6d4ebf0edc368a0 Do not run LSP diagnostics while in insert mode Should help keeping the load down diff -r db80c8ac727d -r f300ef1bc475 dot_config/nvim/config.lua --- a/dot_config/nvim/config.lua Tue Mar 16 12:23:12 2021 +0100 +++ b/dot_config/nvim/config.lua Fri Mar 19 17:55:02 2021 +0100 @@ -454,20 +454,27 @@ vim.lsp.handlers["textDocument/formatting"] = function(err, _, result, _, bufnr) - if err ~= nil or result == nil then - return - end - if not vim.api.nvim_buf_get_option(bufnr, "modified") then - local view = vim.fn.winsaveview() - vim.lsp.util.apply_text_edits(result, bufnr) - -- Fix to reload Treesitter - -- vim.api.nvim_command("edit") - vim.fn.winrestview(view) - end + if err ~= nil or result == nil then + return + end + if not vim.api.nvim_buf_get_option(bufnr, "modified") then + local view = vim.fn.winsaveview() + vim.lsp.util.apply_text_edits(result, bufnr) + -- Fix to reload Treesitter + -- vim.api.nvim_command("edit") + vim.fn.winrestview(view) + end +end + +vim.lsp.handlers["textDocument/publishDiagnostics"] = function(...) + vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, { + underline = true, + update_in_insert = false + })(...) end lsp.pyright.setup{ - on_attach = on_attach; + on_attach = on_attach; } if (vim.fn.executable('efm-langserver') == 1) then