From a70c1ac9c065c0c5c19227b6952dc579a2b6cecd Mon Sep 17 00:00:00 2001 From: David Luevano Alvarado Date: Tue, 9 Apr 2024 10:49:10 -0600 Subject: fix: python ruff/pyright --- lua/plugins/lspconfig.lua | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) (limited to 'lua/plugins') diff --git a/lua/plugins/lspconfig.lua b/lua/plugins/lspconfig.lua index bd6f4c5..bcbe84e 100644 --- a/lua/plugins/lspconfig.lua +++ b/lua/plugins/lspconfig.lua @@ -44,7 +44,18 @@ local servers = { } } }, - pyright = {}, + pyright = { + pyright = { + -- Using Ruff's import organizer + disableOrganizeImports = true, + }, + python = { + analysis = { + -- Ignore all files for analysis to exclusively use Ruff for linting + ignore = { '*' }, + }, + }, + }, lua_ls = { Lua = { telemetry = { enable = false }, @@ -104,7 +115,11 @@ return { capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) -- TODO: change keybinds to the autocmd suggested by the lspconfig github - local on_attach = function(_, bufnr) -- _ is client + local on_attach = function(client, bufnr) + if client.name == 'ruff_lsp' then + -- Disable hover in favor of Pyright + client.server_capabilities.hoverProvider = false + end -- Create a command `:Format` local to the LSP buffer vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) vim.lsp.buf.format({ async = false }) -- cgit v1.2.3-70-g09d2