Skip to content

Commit d0f1faa

Browse files
committed
feat(python): use pyrefly and ruff to replace pylsp
1 parent c5e4708 commit d0f1faa

File tree

3 files changed

+2
-107
lines changed

3 files changed

+2
-107
lines changed

lua/core/settings.lua

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,9 @@ settings["lsp_deps"] = {
118118
"html",
119119
"jsonls",
120120
"lua_ls",
121-
"pylsp",
122121
"gopls",
122+
"pyrefly",
123+
"ruff",
123124
}
124125

125126
-- General-purpose sources for none-ls to install during bootstrap.

lua/modules/configs/completion/mason.lua

Lines changed: 0 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -31,66 +31,6 @@ M.setup = function()
3131
},
3232
},
3333
})
34-
35-
-- Additional plugins for pylsp
36-
mason_registry:on(
37-
"package:install:success",
38-
vim.schedule_wrap(function(pkg)
39-
if pkg.name ~= "python-lsp-server" then
40-
return
41-
end
42-
43-
local venv = vim.fn.stdpath("data") .. "/mason/packages/python-lsp-server/venv"
44-
local python = is_windows and venv .. "/Scripts/python.exe" or venv .. "/bin/python"
45-
local black = is_windows and venv .. "/Scripts/black.exe" or venv .. "/bin/black"
46-
local ruff = is_windows and venv .. "/Scripts/ruff.exe" or venv .. "/bin/ruff"
47-
48-
require("plenary.job")
49-
:new({
50-
command = python,
51-
args = {
52-
"-m",
53-
"pip",
54-
"install",
55-
"-U",
56-
"--disable-pip-version-check",
57-
"python-lsp-black",
58-
"python-lsp-ruff",
59-
"pylsp-rope",
60-
},
61-
cwd = venv,
62-
env = { VIRTUAL_ENV = venv },
63-
on_exit = function()
64-
if vim.fn.executable(black) == 1 and vim.fn.executable(ruff) == 1 then
65-
vim.notify(
66-
"Finished installing pylsp plugins",
67-
vim.log.levels.INFO,
68-
{ title = "[lsp] Install Status" }
69-
)
70-
else
71-
vim.notify(
72-
"Failed to install pylsp plugins. [Executable not found]",
73-
vim.log.levels.ERROR,
74-
{ title = "[lsp] Install Failure" }
75-
)
76-
end
77-
end,
78-
on_start = function()
79-
vim.notify(
80-
"Now installing pylsp plugins...",
81-
vim.log.levels.INFO,
82-
{ title = "[lsp] Install Status", timeout = 6000 }
83-
)
84-
end,
85-
on_stderr = function(_, msg_stream)
86-
if msg_stream then
87-
vim.notify(msg_stream, vim.log.levels.ERROR, { title = "[lsp] Install Failure" })
88-
end
89-
end,
90-
})
91-
:start()
92-
end)
93-
)
9434
end
9535

9636
return M

lua/modules/configs/completion/servers/pylsp.lua

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)