From 185f35bb4298063f85b0d82d6261915f8aff493a Mon Sep 17 00:00:00 2001 From: Szwendacz99 Date: Wed, 16 Nov 2022 15:28:23 +0100 Subject: [PATCH] small python linters,lsp rework --- lua/my-lint.lua | 33 +++++++++++++++++++-------------- lua/my-lspconfig.lua | 42 +++++++++++++++++++++++++++++++++++++----- 2 files changed, 56 insertions(+), 19 deletions(-) diff --git a/lua/my-lint.lua b/lua/my-lint.lua index 12e4025..97a2ea0 100644 --- a/lua/my-lint.lua +++ b/lua/my-lint.lua @@ -1,22 +1,27 @@ require('lint').linters_by_ft = { - python = { 'flake8', 'pylint', 'pycodestyle', 'pydocstyle' }, + --python = { + --'flake8', + --'pylint', + --'pycodestyle', + --'pydocstyle' + --}, php = { 'phpcs' }, markdown = { 'markdownlint' } } -local pydocstyle = require('lint.linters.pydocstyle') -pydocstyle.args = { - '--ignore=D100,D203,D213', -- disable missing module docstring info - -- disable one line before class docstring required - -- disable multiline docstring summary - -- should start at the second line -} -local pylint = require('lint.linters.pylint') -pylint.args = { - '-f', - 'json', - '--disable=C0114', -- disable missing module docstring info -} +--local pydocstyle = require('lint.linters.pydocstyle') +--pydocstyle.args = { + --'--ignore=D100,D203,D213', -- disable missing module docstring info + ---- disable one line before class docstring required + ---- disable multiline docstring summary + ---- should start at the second line +--} +--local pylint = require('lint.linters.pylint') +--pylint.args = { + --'-f', + --'json', + --'--disable=C0114', -- disable missing module docstring info +--} vim.api.nvim_create_autocmd({ "BufWritePost" }, { callback = function() diff --git a/lua/my-lspconfig.lua b/lua/my-lspconfig.lua index 249a0ab..e86368a 100644 --- a/lua/my-lspconfig.lua +++ b/lua/my-lspconfig.lua @@ -41,12 +41,44 @@ require 'lspconfig'.pyright.setup { } require 'lspconfig'.pylsp.setup { on_attach = on_attach, - capabilities = capabilities, -} -require 'lspconfig'.pyre.setup { - on_attach = on_attach, - capabilities = capabilities, + capabilities = capabilities + , settings = { + pylsp = { + plugins = { + flake8 = { + enabled = 1 + }, + pylint = { + enabled = true, + args = { + '--disable=C0114' -- disable missing module docstring info + } + }, + yapf = { + enabled = true + }, + autopep8 = { + enabled = false + }, + pyflakes = {enabled = true}, + pyodestyle = {enabled = true}, + pydocstyle = { + enabled = false, + ignore = { + 'D100', -- disable missing module docstring info + 'D203', -- disable one line before class docstring required + 'D213' -- disable multiline docstring summary + -- should start at the second line + } + }, + } + } + } } +--require 'lspconfig'.pyre.setup { +--on_attach = on_attach, +--capabilities = capabilities, +--} require 'lspconfig'.bashls.setup { on_attach = on_attach, capabilities = capabilities,