diff --git a/lua/lazyvim/plugins/extras/lang/python.lua b/lua/lazyvim/plugins/extras/lang/python.lua index d50b373d..3e7f5d59 100644 --- a/lua/lazyvim/plugins/extras/lang/python.lua +++ b/lua/lazyvim/plugins/extras/lang/python.lua @@ -2,11 +2,11 @@ if lazyvim_docs then -- LSP Server to use for Python. -- Set to "basedpyright" to use basedpyright instead of pyright. vim.g.lazyvim_python_lsp = "pyright" - vim.g.lazyvim_ruff = "ruff_lsp" + vim.g.lazyvim_python_ruff = "ruff_lsp" end local lsp = vim.g.lazyvim_python_lsp or "pyright" -local ruff = vim.g.lazyvim_ruff or "ruff_lsp" +local ruff = vim.g.lazyvim_python_ruff or "ruff_lsp" return { { @@ -32,24 +32,11 @@ return { }, ruff_lsp = { enabled = ruff == "ruff_lsp", - keys = { - { - "co", - function() - vim.lsp.buf.code_action({ - apply = true, - context = { - only = { "source.organizeImports" }, - diagnostics = {}, - }, - }) - end, - desc = "Organize Imports", - }, - }, }, ruff = { enabled = ruff == "ruff", + }, + [ruff] = { keys = { { "co", @@ -68,17 +55,9 @@ return { }, }, setup = { - ruff_lsp = function() + [ruff] = function() LazyVim.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, - ruff = function() - LazyVim.lsp.on_attach(function(client, _) - if client.name == "ruff" then + if client.name == ruff then -- Disable hover in favor of Pyright client.server_capabilities.hoverProvider = false end