From 818a34a7ff028d44fd86cea4312f436c5dbfd22a Mon Sep 17 00:00:00 2001 From: Sanchayan Maity Date: Mon, 29 Nov 2021 11:54:53 +0530 Subject: [PATCH] nvim: lsp: Enable flake8 & pylint for pylsp See documentation https://github.com/python-lsp/python-lsp-server/blob/develop/CONFIGURATION.md --- nvim/.config/nvim/lua/lsp.lua | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/nvim/.config/nvim/lua/lsp.lua b/nvim/.config/nvim/lua/lsp.lua index 198c4ed..d23bab4 100644 --- a/nvim/.config/nvim/lua/lsp.lua +++ b/nvim/.config/nvim/lua/lsp.lua @@ -187,14 +187,6 @@ local rust_tool_opts = { }, } -local servers = { 'hls', 'pylsp' } -for _, lsp in ipairs(servers) do - nvim_lsp[lsp].setup { - on_attach = on_attach, - capabilities = capabilities - } -end - nvim_lsp.clangd.setup { on_attach = on_attach, capabilities = capabilities, @@ -211,6 +203,29 @@ nvim_lsp.clangd.setup { } } +nvim_lsp.hls.setup { + on_attach = on_attach, + capabilities = capabilities +} + +nvim_lsp.pylsp.setup { + on_attach = on_attach, + capabilities = capabilities, + settings = { + pylsp = { + plugins = { + flake8 = { + enabled = true, + config = vim.fn.expand('~/.config/flake8') + }, + pylint = { + enabled = true, + } + } + } + } +} + require('rust-tools').setup(rust_tool_opts) nvim_lsp.tsserver.setup {