I am using Pyright
LSP as main LSP server and pylsp
for pep8 validation but is there problem with renaming. It happens 2 times a row: one from Pyright
and another from pylsp
. What is wrong in my config and how to disable pylsp renaming?
And maybe someone can explain how to properly setup Rope, i tried to move from pyright to pylsp with rope, but it extremely slow, something about 5 seconds needs Rope to create autocompletion and GoToDefinition works only for my methods, instead all libs in Pyright, also Rope cannot autocomplete libs methods, it works only for methods written by me
{
"neovim/nvim-lspconfig",
config = function()
local lspconfig = require("lspconfig")
local capabilities = require('cmp_nvim_lsp').default_capabilities()
lspconfig.pyright.setup({
capabilities = capabilities,
})
local venv_path = os.getenv('VIRTUAL_ENV')
local py_path = nil
-- decide which python executable to use for mypy
if venv_path ~= nil then
py_path = venv_path .. "/bin/python3"
else
py_path = ".venv/bin/python"
end
lspconfig.pylsp.setup({
capabilities = capabilities,
settings = {
pylsp = {
plugins = {
black = { enabled = false },
autopep8 = { enabled = false },
yapf = { enabled = false },
flake8 = {
enabled = true,
maxLineLength = 120
},
pylint = { enabled = false, executable = "pylint" },
ruff = { enabled = false },
pyflakes = { enabled = false },
pycodestyle = { enabled = false },
-- type checker
pylsp_mypy = {
enabled = false,
overrides = { "--python-executable", py_path, true },
report_progress = true,
live_mode = false
},
-- auto-completion options
jedi_completion = {
enabled = false,
fuzzy = true,
},
jedi_definition = {
enabled = false,
},
rope_autoimport = {
enabled = false,
memory = true,
completions = {
enabled = true
},
code_actions = {
enabled = true
}
},
rope_completion = {
enabled = false,
eager = true
},
-- import sorting
isort = { enabled = true },
}
}
})
As @MonsieurMerso advised, I disabled renaming in on_attach
method during initialization pyslp
lspconfig.pylsp.setup({
capabilities = capabilities,
on_attach = function (client)
client.server_capabilities.renameProvider = false
end,
...
})