2023-11-17 22:02:07 +00:00
|
|
|
local M = {}
|
2023-11-17 18:00:35 +00:00
|
|
|
|
2023-11-20 22:44:04 +00:00
|
|
|
function M.nvim_dap()
|
2024-03-05 03:10:57 +00:00
|
|
|
local dap = require("dap")
|
|
|
|
local key = "debugpy"
|
2023-11-17 18:00:35 +00:00
|
|
|
|
2023-11-22 13:11:41 +00:00
|
|
|
dap.adapters[key] = {
|
2024-03-05 03:10:57 +00:00
|
|
|
type = "executable",
|
|
|
|
command = "python3",
|
|
|
|
args = { "-m", "debugpy.adapter" },
|
2023-11-22 13:11:41 +00:00
|
|
|
options = {
|
2024-03-05 03:10:57 +00:00
|
|
|
source_filetype = "python",
|
2023-11-22 13:11:41 +00:00
|
|
|
},
|
|
|
|
}
|
2023-11-17 18:00:35 +00:00
|
|
|
|
|
|
|
dap.configurations.python = dap.configurations.python or {}
|
|
|
|
table.insert(dap.configurations.python, {
|
2024-03-05 03:10:57 +00:00
|
|
|
name = "Launch File",
|
2023-11-22 13:11:41 +00:00
|
|
|
type = key,
|
2024-03-05 03:10:57 +00:00
|
|
|
request = "launch",
|
|
|
|
program = "${file}",
|
|
|
|
cwd = "${workspaceFolder}",
|
2023-11-17 18:00:35 +00:00
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2023-11-17 22:02:07 +00:00
|
|
|
function M.nvim_lspconfig()
|
2024-03-05 03:10:57 +00:00
|
|
|
require("utils.lsp").setup(require("lspconfig").pylsp) {
|
2023-11-17 18:00:35 +00:00
|
|
|
settings = {
|
|
|
|
pylsp = {
|
|
|
|
-- `flake8` currently fails in some cases. Prefer the default set of
|
|
|
|
-- utilities instead.
|
|
|
|
-- https://github.com/python-lsp/python-lsp-server/pull/434
|
2024-03-05 03:10:57 +00:00
|
|
|
configurationSources = "pycodestyle",
|
2023-11-17 18:00:35 +00:00
|
|
|
plugins = {
|
|
|
|
autopep8 = { enabled = false },
|
|
|
|
black = { enabled = true },
|
|
|
|
mccabe = { enabled = true },
|
|
|
|
pycodestyle = { enabled = true },
|
|
|
|
pyflakes = { enabled = true },
|
|
|
|
yapf = { enabled = false },
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|
|
|
|
end
|
|
|
|
|
2023-11-17 22:02:07 +00:00
|
|
|
return M
|