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()
|
2023-11-17 18:00:35 +00:00
|
|
|
local dap = require('dap')
|
2023-11-22 13:11:41 +00:00
|
|
|
local key = 'debugpy'
|
2023-11-17 18:00:35 +00:00
|
|
|
|
2023-11-22 13:11:41 +00:00
|
|
|
dap.adapters[key] = {
|
|
|
|
type = 'executable',
|
|
|
|
command = 'python3',
|
|
|
|
args = { '-m', 'debugpy.adapter' },
|
|
|
|
options = {
|
|
|
|
source_filetype = 'python',
|
|
|
|
},
|
|
|
|
}
|
2023-11-17 18:00:35 +00:00
|
|
|
|
|
|
|
dap.configurations.python = dap.configurations.python or {}
|
|
|
|
table.insert(dap.configurations.python, {
|
2023-11-22 13:11:41 +00:00
|
|
|
name = 'Launch File',
|
|
|
|
type = key,
|
2023-11-17 18:00:35 +00:00
|
|
|
request = 'launch',
|
|
|
|
program = '${file}',
|
|
|
|
cwd = '${workspaceFolder}',
|
|
|
|
})
|
|
|
|
end
|
|
|
|
|
2023-11-17 22:02:07 +00:00
|
|
|
function M.nvim_lspconfig()
|
2023-11-20 15:02:47 +00:00
|
|
|
require('init.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
|
|
|
|
configurationSources = 'pycodestyle',
|
|
|
|
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
|