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

39 lines
1 KiB
Lua

return {
require("util").setup_lang({ treesitter = { "python", "toml" }, mason = { "ruff", "ruff-lsp" } }),
-- modified from https://www.lazyvim.org/extras/lang/python#nvim-lspconfig
{
"neovim/nvim-lspconfig",
opts = {
-- autoformat = false,
servers = {
ruff_lsp = {
keys = {
{
"<leader>co",
function()
vim.lsp.buf.code_action({
apply = true,
context = {
only = { "source.organizeImports" },
diagnostics = {},
},
})
end,
desc = "Organize Imports",
},
},
},
},
setup = {
ruff_lsp = function()
require("lazyvim.util").lsp.on_attach(function(client, _)
if client.name == "ruff_lsp" then
-- Disable hover in favor of Pyright
client.server_capabilities.hoverProvider = false
end
end)
end,
},
},
},
}