nixos-configuration/jrpotter/neovim/lua/init/python.lua

50 lines
1.2 KiB
Lua
Raw Normal View History

local M = {}
function M.nvim_dap()
local dap = require('dap')
dap.adapters.python = function(callback, config)
callback({
name = 'debugpy',
type = 'executable',
command = 'python3',
args = { '-m', 'debugpy.adapter' },
options = {
source_filetype = 'python',
},
})
end
dap.configurations.python = dap.configurations.python or {}
table.insert(dap.configurations.python, {
name = 'Launch',
type = 'python',
request = 'launch',
program = '${file}',
cwd = '${workspaceFolder}',
})
end
function M.nvim_lspconfig()
require('init.lsp').setup(require('lspconfig').pylsp) {
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
return M