Skip to content

Commit

Permalink
fix: correct path for pylsp plugins on windows, close ayamir#778. (ay…
Browse files Browse the repository at this point in the history
…amir#779)

Signed-off-by: ayamir <lgt986452565@gmail.com>
  • Loading branch information
ayamir authored and bleedingfight committed Jun 22, 2023
1 parent bd8ead5 commit 2cb76c7
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lua/modules/configs/completion/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ return function()
},
})

local is_win = require("core.global").is_windows

-- Additional plugins for pylsp
mason_registry:on(
"package:install:success",
Expand All @@ -43,9 +45,12 @@ return function()
end

local venv = vim.fn.stdpath("data") .. "/mason/packages/python-lsp-server/venv"
local python = is_win and venv .. "/Scripts/python.exe" or venv .. "/bin/python"
local black = is_win and venv .. "/Scripts/black.exe" or venv .. "/bin/black"
local ruff = is_win and venv .. "/Scripts/ruff.exe" or venv .. "/bin/ruff"
require("plenary.job")
:new({
command = venv .. "/bin/python",
command = python,
args = {
"-m",
"pip",
Expand All @@ -59,10 +64,7 @@ return function()
cwd = venv,
env = { VIRTUAL_ENV = venv },
on_exit = function()
if
vim.fn.executable(venv .. "/bin/black") == 1
and vim.fn.executable(venv .. "/bin/ruff") == 1
then
if vim.fn.executable(black) == 1 and vim.fn.executable(ruff) == 1 then
vim.notify(
"Finished installing pylsp plugins",
vim.log.levels.INFO,
Expand Down

0 comments on commit 2cb76c7

Please # to comment.