From 34183a2759828001b08679659f7d5170d7ec367e Mon Sep 17 00:00:00 2001 From: Iordanis Petkakis <12776461+dpetka2001@users.noreply.github.com> Date: Fri, 3 May 2024 10:23:31 +0300 Subject: [PATCH] fix(python): make both `ruff` and `ruff_lsp` available to user (#3060) * fix(python): make both `ruff` and `ruff_lsp` available to user Provide global variable to choose between `ruff` and `ruff_lsp` in accordance to `pyright`/`basedpyright` * refactor(python): ruff stuff --------- Co-authored-by: Folke Lemaitre --- lua/lazyvim/plugins/extras/lang/python.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/lua/lazyvim/plugins/extras/lang/python.lua b/lua/lazyvim/plugins/extras/lang/python.lua index b36fd80c..3e7f5d59 100644 --- a/lua/lazyvim/plugins/extras/lang/python.lua +++ b/lua/lazyvim/plugins/extras/lang/python.lua @@ -2,9 +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_python_ruff = "ruff_lsp" end local lsp = vim.g.lazyvim_python_lsp or "pyright" +local ruff = vim.g.lazyvim_python_ruff or "ruff_lsp" return { { @@ -28,7 +30,13 @@ return { [lsp] = { enabled = true, }, + ruff_lsp = { + enabled = ruff == "ruff_lsp", + }, ruff = { + enabled = ruff == "ruff", + }, + [ruff] = { keys = { { "co", @@ -47,9 +55,9 @@ return { }, }, setup = { - ruff = function() + [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