dotfiles/home/private_dot_config/nvim/lua/plugins/language/python.lua

40 lines
1 KiB
Lua
Raw Normal View History

2024-11-20 13:11:36 -06:00
-- 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"
2023-11-30 14:25:23 -06:00
return {
2024-11-20 13:11:36 -06:00
require("util").setup_lang({ treesitter = { "python", "toml" }, mason = { "ruff" } }),
2023-11-30 14:25:23 -06:00
{
"neovim/nvim-lspconfig",
opts = {
servers = {
2024-11-20 13:11:36 -06:00
pyright = { enabled = true },
ruff = {
enabled = true,
cmd_env = { RUFF_TRACE = "messages" },
init_options = {
settings = {
logLevel = "error",
},
},
2023-11-30 14:25:23 -06:00
keys = {
{
"<leader>co",
2024-11-20 13:11:36 -06:00
LazyVim.lsp.action["source.organizeImports"],
2023-11-30 14:25:23 -06:00
desc = "Organize Imports",
},
},
},
},
setup = {
2024-11-20 13:11:36 -06:00
[ruff] = function()
LazyVim.lsp.on_attach(function(client, _)
-- Disable hover in favor of Pyright
client.server_capabilities.hoverProvider = false
end, ruff)
2023-11-30 14:25:23 -06:00
end,
},
},
},
}