nvim+mypy

This commit is contained in:
Henrik Bakken
2025-09-12 13:02:23 +02:00
parent ddebef05e0
commit f6513daf77
2 changed files with 37 additions and 24 deletions
+5 -17
View File
@@ -1,18 +1,6 @@
[mypy]
show_error_context = True
show_error_codes = True
show_column_numbers = True
pretty = True
color_output = True
disallow_untyped_calls = False
disallow_untyped_defs = True
disallow_incomplete_defs = True
disallow_untyped_decorators = True
# warn_redundant_casts = True
# warn_unused_ignores = True
# warn_unreachable = True
warn_return_any = False
no_implicit_optional = True
strict_optional = True
strict = true
local_partial_types = true
warn_return_any = false
disallow_subclassing_any = false
pretty = true
+32 -7
View File
@@ -439,8 +439,36 @@ local function makespec_lspconfig()
},
},
})
lspconfig.pyright.setup({
cmd = { "pyright-langserver", "--stdio", "--threads", "20" },
lspconfig.pylsp.setup({
filetypes = { "python" },
root_dir = function(fname)
local root_files = {
".git",
"pyproject.toml",
"setup.py",
"setup.cfg",
"requirements.txt",
"Pipfile",
"pyrightconfig.json",
}
return lspconfig.util.root_pattern(unpack(root_files))(fname)
end,
settings = {
pylsp = {
plugins = {
pylsp_mypy = {
enabled = true,
dmypy = true,
},
pycodestyle = { enabled = false },
mccabe = { enabled = false },
},
},
},
-- Other lspconfig options like on_attach, capabilities can be set here
})
lspconfig.basedpyright.setup({
cmd = { "basedpyright-langserver", "--stdio", "--threads", "20" },
filetypes = { "python" },
root_dir = function(fname)
local root_files = {
@@ -460,7 +488,6 @@ local function makespec_lspconfig()
-- logLevel = "Trace",
autoImportCompletions = false,
diagnosticMode = "workspace",
useLibraryCodeForTypes = true,
logTypeEvaluationTime = true,
typeEvaluationTimeThreshold = 2000,
},
@@ -1061,9 +1088,8 @@ local function makespec_snacks()
{ "<leader>ll", function() Snacks.picker.notifications() end, desc = "Notification History" },
-- code
{ "<leader>cS", function() Snacks.picker.lsp_symbols() end, desc = "LSP Symbols" },
-- replaced by Trouble
-- { "<leader>cW", function() Snacks.picker.lsp_workspace_symbols() end, desc = "LSP Workspace Symbols" },
-- { "<leader>cd", function() Snacks.picker.diagnostics() end, desc = "Diagnostics" },
{ "<leader>cW", function() Snacks.picker.lsp_workspace_symbols() end, desc = "LSP Workspace Symbols" },
{ "<leader>cd", function() Snacks.picker.diagnostics() end, desc = "Diagnostics" },
-- terminal
{ "<C-/>", function() Snacks.terminal.toggle() end, desc = "Snacks Terminal", mode={"n", "t"} },
{ "<C-_>", function() Snacks.terminal.toggle() end, desc = "which_key_ignore", mode={'n', "t"} },
@@ -1153,7 +1179,6 @@ local function makespec_trouble()
},
keys = {
{ "<leader>cc", "<cmd>Trouble diagnostics toggle filter.buf=0<cr>", desc = "Buffer Diagnostics" },
{ "<leader>cd", "<cmd>Trouble diagnostics toggle<cr>", desc = "Diagnostics" },
{ "<leader>cr", "<cmd>Trouble lsp_references toggle<cr>", desc = "References" },
{ "<leader>cs", "<cmd>Trouble symbols toggle<cr>", desc = "Document Symbols" },
{ "<leader>ca", "<cmd>Trouble lsp toggle<cr>", desc = "LSP references/definitions/..." },