@@ -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- )
9434end
9535
9636return M
0 commit comments