comparison dot_config/nvim/config.lua @ 364:f300ef1bc475

Do not run LSP diagnostics while in insert mode Should help keeping the load down
author Zeger Van de Vannet <zegervdv@me.com>
date Fri, 19 Mar 2021 17:55:02 +0100
parents db80c8ac727d
children 42bc7d63537e
comparison
equal deleted inserted replaced
363:db80c8ac727d 364:f300ef1bc475
452 -- mapper("n", "gp", "<cmd>lua require'lspsaga.provider'.preview_definition()<CR>") 452 -- mapper("n", "gp", "<cmd>lua require'lspsaga.provider'.preview_definition()<CR>")
453 end 453 end
454 454
455 455
456 vim.lsp.handlers["textDocument/formatting"] = function(err, _, result, _, bufnr) 456 vim.lsp.handlers["textDocument/formatting"] = function(err, _, result, _, bufnr)
457 if err ~= nil or result == nil then 457 if err ~= nil or result == nil then
458 return 458 return
459 end 459 end
460 if not vim.api.nvim_buf_get_option(bufnr, "modified") then 460 if not vim.api.nvim_buf_get_option(bufnr, "modified") then
461 local view = vim.fn.winsaveview() 461 local view = vim.fn.winsaveview()
462 vim.lsp.util.apply_text_edits(result, bufnr) 462 vim.lsp.util.apply_text_edits(result, bufnr)
463 -- Fix to reload Treesitter 463 -- Fix to reload Treesitter
464 -- vim.api.nvim_command("edit") 464 -- vim.api.nvim_command("edit")
465 vim.fn.winrestview(view) 465 vim.fn.winrestview(view)
466 end 466 end
467 end
468
469 vim.lsp.handlers["textDocument/publishDiagnostics"] = function(...)
470 vim.lsp.with(vim.lsp.diagnostic.on_publish_diagnostics, {
471 underline = true,
472 update_in_insert = false
473 })(...)
467 end 474 end
468 475
469 lsp.pyright.setup{ 476 lsp.pyright.setup{
470 on_attach = on_attach; 477 on_attach = on_attach;
471 } 478 }
472 479
473 if (vim.fn.executable('efm-langserver') == 1) then 480 if (vim.fn.executable('efm-langserver') == 1) then
474 require 'efm/python' 481 require 'efm/python'
475 482