2023-11-30 14:25:23 -06:00
|
|
|
return {
|
|
|
|
{
|
|
|
|
"nvim-treesitter/nvim-treesitter",
|
|
|
|
opts = function(_, opts)
|
|
|
|
if type(opts.ensure_installed) == "table" then
|
|
|
|
vim.list_extend(opts.ensure_installed, { "python", "toml" })
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"williamboman/mason.nvim",
|
|
|
|
opts = function(_, opts)
|
|
|
|
if type(opts.ensure_installed) == "table" then
|
|
|
|
vim.list_extend(opts.ensure_installed, { "ruff", "ruff-lsp" })
|
|
|
|
end
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"nvimtools/none-ls.nvim",
|
|
|
|
opts = function(_, opts)
|
|
|
|
local nls = require("null-ls")
|
|
|
|
table.insert(opts.sources or {}, nls.builtins.formatting.ruff)
|
|
|
|
end,
|
|
|
|
},
|
|
|
|
-- modified from https://www.lazyvim.org/extras/lang/python#nvim-lspconfig
|
|
|
|
{
|
|
|
|
"neovim/nvim-lspconfig",
|
|
|
|
opts = {
|
2023-12-11 15:45:15 -06:00
|
|
|
-- autoformat = false,
|
2023-11-30 14:25:23 -06:00
|
|
|
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,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|