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 },
pylint = { enabled = false },
autopep8 = { enabled = false },
yapf = { enabled = true },
yapf = { enabled = false },
ruff = {
enabled = true,
formatEnabled = true,
},
},
},
},
})
end,
ruff_lsp = function()
require('lspconfig').ruff_lsp.setup({
on_attach = function(client, bufnr)
client.server_capabilities.hoverProvider = false
client.server_capabilities.documentFormattingProvider = false
end,
})
end,
-- ruff_lsp = function()
-- require('lspconfig').ruff_lsp.setup({
-- on_attach = function(client, bufnr)
-- client.server_capabilities.hoverProvider = false
-- client.server_capabilities.documentFormattingProvider = false
-- end,
-- })
-- end,
texlab = function()
require('lspconfig').texlab.setup({
settings = {
@ -110,7 +114,7 @@ return {
opts = {
handlers = handlers,
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')
M.mason_post_install = function(pkg)
--if pkg.name ~= 'python-lsp-server' then
-- return
--end
--local venv = vim.fn.stdpath('data') .. '/mason/packages/python-lsp-server/venv'
--local job = require('plenary.job')
--job:new({
-- command = venv .. '/bin/pip',
-- args = {
-- 'install',
-- '-U',
-- '--disable-pip-version-check',
-- 'pylsp-mypy',
-- },
-- cwd = venv,
-- env = { VIRTUAL_ENV = venv },
-- on_exit = function()
-- notify('Finished installing pylsp modules.')
-- end,
-- on_start = function()
-- notify('Installing pylsp modules...')
-- end,
--}):start()
if pkg.name ~= 'python-lsp-server' then
return
end
local venv = vim.fn.stdpath('data') .. '/mason/packages/python-lsp-server/venv'
local job = require('plenary.job')
job:new({
command = venv .. '/bin/pip',
args = {
'install',
'-U',
'--disable-pip-version-check',
'python-lsp-ruff',
},
cwd = venv,
env = { VIRTUAL_ENV = venv },
on_exit = function()
notify('Finished installing pylsp modules.')
end,
on_start = function()
notify('Installing pylsp modules...')
end,
}):start()
end
M.ruff = function()