use ruff as pylsp plugin instead of separate lsp

This commit is contained in:
Thies Lennart Alff 2024-05-17 15:38:58 +02:00
parent b019fc12d2
commit bbe9e0c163
2 changed files with 36 additions and 32 deletions

View file

@ -51,20 +51,24 @@ local handlers = {
flake8 = { enabled = false }, flake8 = { enabled = false },
pylint = { enabled = false }, pylint = { enabled = false },
autopep8 = { enabled = false }, autopep8 = { enabled = false },
yapf = { enabled = true }, yapf = { enabled = false },
ruff = {
enabled = true,
formatEnabled = true,
},
}, },
}, },
}, },
}) })
end, end,
ruff_lsp = function() -- ruff_lsp = function()
require('lspconfig').ruff_lsp.setup({ -- require('lspconfig').ruff_lsp.setup({
on_attach = function(client, bufnr) -- on_attach = function(client, bufnr)
client.server_capabilities.hoverProvider = false -- client.server_capabilities.hoverProvider = false
client.server_capabilities.documentFormattingProvider = false -- client.server_capabilities.documentFormattingProvider = false
end, -- end,
}) -- })
end, -- end,
texlab = function() texlab = function()
require('lspconfig').texlab.setup({ require('lspconfig').texlab.setup({
settings = { settings = {
@ -110,7 +114,7 @@ return {
opts = { opts = {
handlers = handlers, handlers = handlers,
ensure_installed = { ensure_installed = {
'lua_ls', 'clangd', 'pylsp', 'yamlls', 'esbonio', 'ruff_lsp', 'lemminx', 'lua_ls', 'clangd', 'pylsp', 'yamlls', 'esbonio', 'lemminx'
}, },
}, },
}, },

View file

@ -2,28 +2,28 @@ local M = {}
local notify = require('notify') local notify = require('notify')
M.mason_post_install = function(pkg) M.mason_post_install = function(pkg)
--if pkg.name ~= 'python-lsp-server' then if pkg.name ~= 'python-lsp-server' then
-- return return
--end end
--local venv = vim.fn.stdpath('data') .. '/mason/packages/python-lsp-server/venv' local venv = vim.fn.stdpath('data') .. '/mason/packages/python-lsp-server/venv'
--local job = require('plenary.job') local job = require('plenary.job')
--job:new({ job:new({
-- command = venv .. '/bin/pip', command = venv .. '/bin/pip',
-- args = { args = {
-- 'install', 'install',
-- '-U', '-U',
-- '--disable-pip-version-check', '--disable-pip-version-check',
-- 'pylsp-mypy', 'python-lsp-ruff',
-- }, },
-- cwd = venv, cwd = venv,
-- env = { VIRTUAL_ENV = venv }, env = { VIRTUAL_ENV = venv },
-- on_exit = function() on_exit = function()
-- notify('Finished installing pylsp modules.') notify('Finished installing pylsp modules.')
-- end, end,
-- on_start = function() on_start = function()
-- notify('Installing pylsp modules...') notify('Installing pylsp modules...')
-- end, end,
--}):start() }):start()
end end
M.ruff = function() M.ruff = function()