From 09af3f70a1f5915a62d5d54aa7c9df7fa2405040 Mon Sep 17 00:00:00 2001 From: dogeystamp Date: Wed, 12 Apr 2023 12:40:57 -0400 Subject: [PATCH] nvim: make Python LSP also check docstrings --- src/.config/nvim/lua/init.lua | 33 ++++++++++++++++++++++++++------- src/.config/pycodestyle | 3 +++ 2 files changed, 29 insertions(+), 7 deletions(-) create mode 100644 src/.config/pycodestyle diff --git a/src/.config/nvim/lua/init.lua b/src/.config/nvim/lua/init.lua index b3dd90d..dedfa37 100644 --- a/src/.config/nvim/lua/init.lua +++ b/src/.config/nvim/lua/init.lua @@ -47,14 +47,33 @@ local on_attach = function(client, bufnr) buf_set_keymap('n', 'ca', 'lua vim.lsp.buf.code_action()', opts) end -local servers = { 'pylsp', 'clangd' } -for _, lsp in ipairs(servers) do -nvim_lsp[lsp].setup { - on_attach = on_attach, - flags = { - debounce_text_changes = 150, - } +-- settings per server (overrides defaults) +local servers = { + pylsp = { + settings = { + pylsp = { + plugins = { + pydocstyle = { + enabled = true, + convention = "numpy", + addIgnore = {"D100", "D101", "D102", "D105"} + } + } + } + } + }, + clangd = {} } +for lsp, sv_settings in pairs(servers) do + -- defaults + settings = { + on_attach = on_attach, + flags = { + debounce_text_changes = 150, + } + } + for k, v in pairs(servers) do settings[k] = v end + nvim_lsp[lsp].setup(settings[lsp]) end -- fancy prompts diff --git a/src/.config/pycodestyle b/src/.config/pycodestyle new file mode 100644 index 0000000..f6c7a4a --- /dev/null +++ b/src/.config/pycodestyle @@ -0,0 +1,3 @@ +[pycodestyle] +ignore = E203 +max-line-length = 88