2025-01-02 15:55:52 +01:00
|
|
|
return {
|
|
|
|
"mfussenegger/nvim-lint",
|
|
|
|
config = function ()
|
2025-02-17 17:57:36 +01:00
|
|
|
local mypy = require("lint").linters.mypy
|
|
|
|
mypy.args = {
|
2025-01-28 01:20:14 +01:00
|
|
|
'--show-column-numbers',
|
|
|
|
'--show-error-end',
|
|
|
|
'--hide-error-context',
|
|
|
|
'--no-color-output',
|
|
|
|
'--no-error-summary',
|
|
|
|
'--no-pretty',
|
2025-01-29 15:18:37 +01:00
|
|
|
'--cache-dir',
|
2025-02-17 17:57:36 +01:00
|
|
|
vim.fn.stdpath("cache") .. '/mypy',
|
2025-01-29 15:18:37 +01:00
|
|
|
'--cache-fine-grained',
|
|
|
|
'--sqlite-cache',
|
|
|
|
'--skip-cache-mtime-checks',
|
2025-01-28 14:20:53 +01:00
|
|
|
'--python-executable',
|
|
|
|
function()
|
|
|
|
return vim.fn.exepath 'python3' or vim.fn.exepath 'python'
|
|
|
|
end
|
2025-01-28 01:20:14 +01:00
|
|
|
}
|
2025-01-02 15:55:52 +01:00
|
|
|
require("lint").linters_by_ft = {
|
2025-02-17 17:57:36 +01:00
|
|
|
python = {"mypy"},
|
2025-01-02 15:55:52 +01:00
|
|
|
}
|
|
|
|
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
|
|
|
callback = function()
|
|
|
|
-- try_lint without arguments runs the linters defined in `linters_by_ft`
|
2025-02-17 17:57:36 +01:00
|
|
|
-- for the current tile type
|
2025-01-02 15:55:52 +01:00
|
|
|
require("lint").try_lint()
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
end
|
|
|
|
}
|