mirror of
https://github.com/LazyVim/LazyVim.git
synced 2026-07-25 14:01:06 +00:00
refactor(python): ruff stuff
This commit is contained in:
parent
80c9324440
commit
cad98c47dc
1 changed files with 6 additions and 27 deletions
|
|
@ -2,11 +2,11 @@ if lazyvim_docs then
|
||||||
-- LSP Server to use for Python.
|
-- LSP Server to use for Python.
|
||||||
-- Set to "basedpyright" to use basedpyright instead of pyright.
|
-- Set to "basedpyright" to use basedpyright instead of pyright.
|
||||||
vim.g.lazyvim_python_lsp = "pyright"
|
vim.g.lazyvim_python_lsp = "pyright"
|
||||||
vim.g.lazyvim_ruff = "ruff_lsp"
|
vim.g.lazyvim_python_ruff = "ruff_lsp"
|
||||||
end
|
end
|
||||||
|
|
||||||
local lsp = vim.g.lazyvim_python_lsp or "pyright"
|
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 {
|
return {
|
||||||
{
|
{
|
||||||
|
|
@ -32,24 +32,11 @@ return {
|
||||||
},
|
},
|
||||||
ruff_lsp = {
|
ruff_lsp = {
|
||||||
enabled = ruff == "ruff_lsp",
|
enabled = ruff == "ruff_lsp",
|
||||||
keys = {
|
|
||||||
{
|
|
||||||
"<leader>co",
|
|
||||||
function()
|
|
||||||
vim.lsp.buf.code_action({
|
|
||||||
apply = true,
|
|
||||||
context = {
|
|
||||||
only = { "source.organizeImports" },
|
|
||||||
diagnostics = {},
|
|
||||||
},
|
|
||||||
})
|
|
||||||
end,
|
|
||||||
desc = "Organize Imports",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
ruff = {
|
ruff = {
|
||||||
enabled = ruff == "ruff",
|
enabled = ruff == "ruff",
|
||||||
|
},
|
||||||
|
[ruff] = {
|
||||||
keys = {
|
keys = {
|
||||||
{
|
{
|
||||||
"<leader>co",
|
"<leader>co",
|
||||||
|
|
@ -68,17 +55,9 @@ return {
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
setup = {
|
setup = {
|
||||||
ruff_lsp = function()
|
[ruff] = function()
|
||||||
LazyVim.lsp.on_attach(function(client, _)
|
LazyVim.lsp.on_attach(function(client, _)
|
||||||
if client.name == "ruff_lsp" then
|
if client.name == ruff 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
|
|
||||||
-- Disable hover in favor of Pyright
|
-- Disable hover in favor of Pyright
|
||||||
client.server_capabilities.hoverProvider = false
|
client.server_capabilities.hoverProvider = false
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue