dotfiles/home/private_dot_config/nvim/lua/plugins/language/python.lua
2024-11-20 13:12:48 -06:00

39 lines
1 KiB
Lua

-- adapted from https://www.lazyvim.org/extras/lang/python#nvim-lspconfig
local lsp = vim.g.lazyvim_python_lsp or "pyright"
local ruff = vim.g.lazyvim_python_ruff or "ruff"
return {
require("util").setup_lang({ treesitter = { "python", "toml" }, mason = { "ruff" } }),
{
"neovim/nvim-lspconfig",
opts = {
servers = {
pyright = { enabled = true },
ruff = {
enabled = true,
cmd_env = { RUFF_TRACE = "messages" },
init_options = {
settings = {
logLevel = "error",
},
},
keys = {
{
"<leader>co",
LazyVim.lsp.action["source.organizeImports"],
desc = "Organize Imports",
},
},
},
},
setup = {
[ruff] = function()
LazyVim.lsp.on_attach(function(client, _)
-- Disable hover in favor of Pyright
client.server_capabilities.hoverProvider = false
end, ruff)
end,
},
},
},
}