Open RRikor opened 3 years ago
I ran into the same kind of issue and eventually ended up with a very different config that does have both working. I have just
require "lspconfig".efm.setup {
filetypes = { "python" },
on_attach = on_attach,
init_options = {documentFormatting = true},
settings = {
rootMarkers = {".git/"},
}
}
in my vim configuration and I think I could probably get rid of the rootMarker too. The other configuration happens in my ~/.config/efm-langserver/config.yaml. E.g.
...
languages:
python:
- <<: *python-flake8
- <<: *python-mypy
- <<: *python-black
- <<: *python-isort
you can update the python-flake8 definition in the yaml file to make any updates (or throw all of those updates into a config file)
After quite some effort I managed to get them both working in a venv along with pyright in the same buffer. Here's the config.settings
I used for both. Removing the lint formats somehow did the trick.
local get_venv_path = function()
local path = vim.fn.getcwd() .. "/"
if vim.fn.has("unix") == 1 then
path = path .. ".venv/bin/"
else
path = path .. ".venv/Scripts/"
end
return path
end
...
python = {
python = {
pythonPath = get_venv_path() .. "python",
analysis = {
autoSearchPaths = true,
diagnosticMode = "workspace",
useLibraryCodeForTypes = true,
},
},
},
efm = {
rootMarkers = { vim.fn.getcwd() },
languages = {
python = {
{
lintCommand = get_venv_path() .. "flake8 --stdin-display-name ${INPUT} -",
lintStdin = true,
lintIgnoreExitCode = true,
lintSource = "flake8",
},
{
lintCommand = get_venv_path() .. "mypy --show-column-numbers",
lintIgnoreExitCode = true,
lintSource = "mypy",
},
{
formatCommand = get_venv_path() .. "black --quiet -",
formatStdin = true,
},
},
lua = { { formatCommand = "stylua -", formatStdin = true } },
},
},
Hello!
Thank you for the great plugin! Unfortunately I have some issues getting my python linting working correctly. When I try to configure both flake8 and mypy for python, only flake8 works. When I remove flake8 then mypy shows linting output. I tried changing the order or adding options as a seperate variable. But nothing seems to do the trick. Am I missing something in this configuration?