mirror of https://gitlab.com/baco/dotconf.git
Merge branch 'pylsp-settings'
This commit is contained in:
commit
a22d0b22d1
|
@ -20,7 +20,7 @@
|
|||
:flake8 (:enabled t)
|
||||
:pylint (:enabled t
|
||||
:executable "pylint")
|
||||
:pylsp_mypy (:enabled t)
|
||||
:pylsp_mypy (:overrides [t "--no-pretty"])
|
||||
:pycodestyle (:enabled :json-false)
|
||||
:pyflakes (:enabled :json-false)))))
|
||||
(when window-system (set-frame-size (selected-frame) 85 60))
|
||||
|
|
|
@ -1,29 +1,3 @@
|
|||
--if vim.fn.exists(":PylspInstall") then
|
||||
-- vim.cmd("PylspInstall pylsp-mypy")
|
||||
--end
|
||||
-- https://github.com/williamboman/mason.nvim/discussions/908
|
||||
local pylsp = require("mason-registry").get_package("python-lsp-server")
|
||||
pylsp:on("install:success", function ()
|
||||
local mason_package_path = function(package)
|
||||
local path = vim.fn.resolve(vim.fn.stdpath("data") .. "/mason/packages/" .. package)
|
||||
return path
|
||||
end
|
||||
|
||||
local path = mason_package_path("python-lsp-server")
|
||||
local command = path .. "/venv/bin/python"
|
||||
|
||||
local install_cmd = { command, "-m", "pip", "install" }
|
||||
local pylsp_plugins = { "python-lsp-ruff", "pylsp-mypy" }
|
||||
vim.schedule(function()
|
||||
vim.fn.system(vim.list_extend(install_cmd, pylsp_plugins))
|
||||
end)
|
||||
|
||||
local flake8_plugins = { "flake8-pyproject", "flake8-pylint" }
|
||||
vim.schedule(function()
|
||||
vim.fn.system(vim.list_extend(install_cmd, flake8_plugins))
|
||||
end)
|
||||
end)
|
||||
|
||||
local opts = {}
|
||||
opts.pylsp = require("lsp.server_settings.pylsp")
|
||||
opts.hls = require("lsp.server_settings.hls")
|
||||
|
|
|
@ -1,13 +1,38 @@
|
|||
--if vim.fn.exists(":PylspInstall") then
|
||||
-- vim.cmd("PylspInstall pylsp-mypy")
|
||||
--end
|
||||
-- https://github.com/williamboman/mason.nvim/discussions/908
|
||||
local pylsp = require("mason-registry").get_package("python-lsp-server")
|
||||
pylsp:on("install:success", function ()
|
||||
local mason_package_path = function(package)
|
||||
local path = vim.fn.resolve(vim.fn.stdpath("data") .. "/mason/packages/" .. package)
|
||||
return path
|
||||
end
|
||||
|
||||
local path = mason_package_path("python-lsp-server")
|
||||
local command = path .. "/venv/bin/python"
|
||||
|
||||
local install_cmd = { command, "-m", "pip", "install" }
|
||||
local pylsp_plugins = { "python-lsp-ruff", "pylsp-mypy" }
|
||||
vim.schedule(function()
|
||||
vim.fn.system(vim.list_extend(install_cmd, pylsp_plugins))
|
||||
end)
|
||||
|
||||
local flake8_plugins = { "flake8-pyproject", "flake8-pylint" }
|
||||
vim.schedule(function()
|
||||
vim.fn.system(vim.list_extend(install_cmd, flake8_plugins))
|
||||
end)
|
||||
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 = { enabled = true },
|
||||
pylsp_mypy = { overrides = { true, "--no-pretty" } },
|
||||
pycodestyle = { enabled = false }, -- covered in flake8
|
||||
pyflakes = { enabled = false }, -- covered in flake8
|
||||
-- mccabe = { enabled = false }, -- not covered in flake8 by default; PyLSP doesn't handle the option
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -4,16 +4,15 @@
|
|||
max-line-length = 79
|
||||
[tool.pylint."messages control"]
|
||||
disable = [
|
||||
# Covered in flake8 according to https://pylint.rtfd.io/en/latest/faq.html#which-messages-should-i-disable-to-avoid-duplicates-if-i-use-other-popular-linters
|
||||
"unnecessary-semicolon", "bad-indentation", "bare-except", # pycodestyle
|
||||
"unnecessary-negation", "singleton-comparison", "line-too-long", # pycodestyle
|
||||
"trailing-whitespace", "missing-final-newline", "trailing-newlines", # pycodestyle
|
||||
"multiple-statements", "wrong-import-position", # pycodestyle
|
||||
"undefined-variable", "unused-import", "unused-variable", # pyflakes
|
||||
"too-many-branches", # mccabe
|
||||
# Covered in flake8 according to https://pylint.rtfd.io/en/latest/faq.html#which-messages-should-i-disable-to-avoid-duplicates-if-i-use-other-popular-linters
|
||||
"unnecessary-semicolon", "bad-indentation", "bare-except", # pycodestyle
|
||||
"unnecessary-negation", "singleton-comparison", "line-too-long", # pycodestyle
|
||||
"trailing-whitespace", "missing-final-newline", "trailing-newlines", # pycodestyle
|
||||
"multiple-statements", "wrong-import-position", # pycodestyle
|
||||
"undefined-variable", "unused-import", "unused-variable", # pyflakes
|
||||
"too-many-branches", # mccabe
|
||||
|
||||
# other stuff
|
||||
# Unfold "missing-docstring" (https://pylint.rtfd.io/en/latest/user_guide/messages/convention/missing-docstring.html)
|
||||
"missing-module-docstring", "missing-class-docstring", "missing-function-docstring",
|
||||
#"invalid-name", "redefined-outer-name", "logging-format-interpolation",
|
||||
# other stuff
|
||||
# Unfold "missing-docstring" (https://pylint.rtfd.io/en/latest/user_guide/messages/convention/missing-docstring.html)
|
||||
"missing-module-docstring", "missing-class-docstring", "missing-function-docstring",
|
||||
]
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
line-length = 79
|
||||
[lint]
|
||||
extend-select = [
|
||||
"E", "W", "F", "C90", # Pycodestyle + Pyflakes + McCabe = Flake8
|
||||
"PL", # Pylint
|
||||
|
|
|
@ -1,10 +1,15 @@
|
|||
[tool.ruff]
|
||||
line-length = 120
|
||||
[tool.ruff.lint]
|
||||
extend-select = [
|
||||
"E", "W", "F", "C90", # Pycodestyle + Pyflakes + McCabe = Flake8
|
||||
"E", "W", "F", # Pycodestyle + Pyflakes - McCabe (C90) = Flake8
|
||||
"PL", # Pylint
|
||||
]
|
||||
[tool.ruff.per-file-ignores]
|
||||
extend-ignore = [
|
||||
"PLW2901", "PLR2004", # From Pylint plugin, not enabled by default
|
||||
"PLR0912", # Already covered: mccabe (C90)
|
||||
]
|
||||
[tool.ruff.lint.per-file-ignores]
|
||||
"__init__.py" = ["F401"]
|
||||
|
||||
[tool.flake8]
|
||||
|
@ -28,13 +33,16 @@ disable = [
|
|||
|
||||
# other stuff
|
||||
"missing-module-docstring", "missing-class-docstring", "missing-function-docstring",
|
||||
#"logging-format-interpolation",
|
||||
#"redefined-outer-name", # Pytest fixtures in tests
|
||||
#"invalid-name", # Class-attributes in Django-commands (.help)
|
||||
]
|
||||
|
||||
[tool.mypy]
|
||||
show_column_numbers = true
|
||||
pretty = true
|
||||
ignore_missing_imports = true
|
||||
follow_imports = "silent"
|
||||
show_error_codes = true
|
||||
|
||||
[tool.pytest.ini_options]
|
||||
addopts = """
|
||||
|
|
Loading…
Reference in New Issue