Skip to content
This repository has been archived by the owner on Oct 16, 2021. It is now read-only.

Pass the jid to post_install_hook #134

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ Note: **don't** replace the `/` with a `.` in the `require` calls above ([see he
* `require'lspinstall'.installed_servers()`

* `require'lspinstall'.install_server(<lang>)`
* `require'lspinstall'.post_install_hook`
* `require'lspinstall'.post_install_hook(<jid>)`

* `require'lspinstall'.uninstall_server(<lang>)`
* `require'lspinstall'.post_uninstall_hook`
Expand Down
4 changes: 2 additions & 2 deletions lua/lspinstall.lua
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,15 @@ function M.install_server(lang)
local path = install_path(lang)
vim.fn.mkdir(path, "p") -- fail: throws

local function onExit(_, code)
local function onExit(jid, code)
if code ~= 0 then
if vim.fn.delete(path, "rf") ~= 0 then -- here 0: success, -1: fail
error("[nvim-lspinstall] Could not delete directory " .. lang)
end
error("[nvim-lspinstall] Could not install language server for " .. lang)
end
vim.notify("[nvim-lspinstall] Successfully installed language server for " .. lang)
if M.post_install_hook then M.post_install_hook() end
if M.post_install_hook then M.post_install_hook(jid) end
end

vim.cmd("new")
Expand Down