39 lines
1 KiB
Lua
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,
|
|
},
|
|
},
|
|
},
|
|
}
|