mirror of https://gitlab.com/baco/dotconf.git
Merge branch 'pylsp-settings'
This commit is contained in:
commit
e93b853fa9
|
@ -16,8 +16,7 @@
|
|||
(add-hook 'prog-mode-hook 'eglot-ensure) ; Requires LSP servers in PATH
|
||||
(setq-default eglot-workspace-configuration
|
||||
'(:pylsp (:configurationSources ["flake8"]
|
||||
:plugins (:ruff (:enabled t)
|
||||
:flake8 (:enabled t)
|
||||
:plugins (:flake8 (:enabled t)
|
||||
:pylint (:enabled t
|
||||
:executable "pylint")
|
||||
:pylsp_mypy (:overrides [t "--no-pretty"])
|
||||
|
|
|
@ -27,7 +27,6 @@ end)
|
|||
local pylsp_settings = {
|
||||
configurationSources = { "flake8" }, -- tool's config files to override settings from
|
||||
plugins = {
|
||||
ruff = { enabled = true }, -- Settings come from $XDG_CONFIG_HOME/ruff/ruff.toml
|
||||
flake8 = { enabled = true },
|
||||
pylint = { enabled = true },
|
||||
pylsp_mypy = { overrides = { true, "--no-pretty" } },
|
||||
|
@ -36,22 +35,24 @@ local pylsp_settings = {
|
|||
},
|
||||
}
|
||||
|
||||
local venv_dir = vim.fn.finddir(".venv/", vim.fn.expand("%:p:h") .. ";")
|
||||
local python_exec = vim.fn.findfile("python3", venv_dir .. "/bin;")
|
||||
if venv_dir ~= "" and python_exec ~= "" then
|
||||
local venv_dir = vim.env.VIRTUAL_ENV
|
||||
if venv_dir ~= nil then
|
||||
local python_exec = vim.fn.findfile("python", venv_dir .. "/bin;")
|
||||
if python_exec ~= "" then
|
||||
pylsp_settings.plugins.jedi = {environment = python_exec}
|
||||
end
|
||||
local flake8_exec = vim.fn.findfile("flake8", venv_dir .. "/bin;")
|
||||
if flake8_exec ~= "" then
|
||||
end
|
||||
local flake8_exec = vim.fn.findfile("flake8", venv_dir .. "/bin;")
|
||||
if flake8_exec ~= "" then
|
||||
pylsp_settings.plugins.flake8.executable = flake8_exec
|
||||
end
|
||||
local pylint_exec = vim.fn.findfile("pylint", venv_dir .. "/bin;")
|
||||
if pylint_exec ~= "" then
|
||||
end
|
||||
local pylint_exec = vim.fn.findfile("pylint", venv_dir .. "/bin;")
|
||||
if pylint_exec ~= "" then
|
||||
pylsp_settings.plugins.pylint.executable = pylint_exec
|
||||
end
|
||||
local mypy_exec = vim.fn.findfile("mypy", venv_dir .. "/bin;")
|
||||
if mypy_exec ~= "" or python_exec ~= "" then
|
||||
end
|
||||
local mypy_exec = vim.fn.findfile("mypy", venv_dir .. "/bin;")
|
||||
if mypy_exec ~= "" or python_exec ~= "" then
|
||||
pylsp_settings.plugins.pylsp_mypy.overrides = {"--python-executable", python_exec, true}
|
||||
end
|
||||
end
|
||||
|
||||
return { settings = { pylsp = pylsp_settings } }
|
||||
|
|
Loading…
Reference in New Issue