From 0d2f897a716764525e3b79bc5951be303b68895d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Doma=C5=84ski?= Date: Thu, 17 Oct 2024 22:58:51 +0200 Subject: [PATCH] [nvim] move from pylps to pyright --- .config/nvim/lua/plugins/lsp.lua | 59 ++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 18 deletions(-) diff --git a/.config/nvim/lua/plugins/lsp.lua b/.config/nvim/lua/plugins/lsp.lua index 8489cff..d18bb14 100644 --- a/.config/nvim/lua/plugins/lsp.lua +++ b/.config/nvim/lua/plugins/lsp.lua @@ -82,6 +82,44 @@ return { lsp_attach = lsp_attach, }) + configs = { + pylsp = { + settings = { + pylsp = { + plugins = { + mypy = { enabled = true }, + black = { enabled = true }, + isort = { enabled = true, profile = "black" }, + }, + }, + }, + }, + ruff_lsp = { + settings = { + args = {}, + format = { + args = { "--line-length=120", "--config", "format.quote-style = 'single'" }, + }, + lint = { + -- args = { "--config", "lint.select = ['F', 'E']", "--config", "lint.ignore = ['E501']" } + } + } + }, + pyright = { + settings = { + pyright = { + disableOptimizeImports = true, + }, + python = { + analysis = { + typeCheckingMode = "basic", + autoImportCompletions = false, + } + } + } + } + } + require('mason').setup({}) require('mason-lspconfig').setup({ -- Replace the language servers listed here @@ -89,29 +127,14 @@ return { ensure_installed = { "lua_ls", "gopls", - "pylsp", + "pyright", "ruff_lsp", "ts_ls", + "mypy" }, handlers = { function(server_name) - lsp_config = {} - - if server_name == "pylsp" then - lsp_config = { - settings = { - pylsp = { - plugins = { - mypy = { enabled = true }, - black = { enabled = true }, - isort = { enabled = true, profile = "black" }, - }, - }, - }, - } - end - - require('lspconfig')[server_name].setup(lsp_config) + require('lspconfig')[server_name].setup(configs[server_name] or {}) end, } })