diff options
| author | William Boman <william@redwill.se> | 2022-01-03 15:12:53 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-01-03 15:12:53 +0100 |
| commit | e8530f4059279a0d6b5e5f8891d04ffb1ade29a3 (patch) | |
| tree | b90ddf4479314af49e1eca3325262ef45e5f630d /lua/nvim-lsp-installer/installers/init.lua | |
| parent | health: add neovim version check (diff) | |
| download | mason-e8530f4059279a0d6b5e5f8891d04ffb1ade29a3.tar mason-e8530f4059279a0d6b5e5f8891d04ffb1ade29a3.tar.gz mason-e8530f4059279a0d6b5e5f8891d04ffb1ade29a3.tar.bz2 mason-e8530f4059279a0d6b5e5f8891d04ffb1ade29a3.tar.lz mason-e8530f4059279a0d6b5e5f8891d04ffb1ade29a3.tar.xz mason-e8530f4059279a0d6b5e5f8891d04ffb1ade29a3.tar.zst mason-e8530f4059279a0d6b5e5f8891d04ffb1ade29a3.zip | |
write install receipts (#379)
Diffstat (limited to 'lua/nvim-lsp-installer/installers/init.lua')
| -rw-r--r-- | lua/nvim-lsp-installer/installers/init.lua | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/lua/nvim-lsp-installer/installers/init.lua b/lua/nvim-lsp-installer/installers/init.lua index ab9ad4f9..cfe48faa 100644 --- a/lua/nvim-lsp-installer/installers/init.lua +++ b/lua/nvim-lsp-installer/installers/init.lua @@ -17,9 +17,11 @@ end ---@alias ServerInstallCallback fun(success: boolean) ---@class ServerInstallContext +---@field receipt InstallReceiptBuilder ---@field requested_server_version string|nil @The version requested by the user. ---@field stdio_sink StdioSink ---@field github_release_file string|nil @Only available if context.use_github_release_file has been called. +---@field github_repo string|nil @Only available if context.use_github_release_file has been called. ---@field os_distribution table<string, any> @Only available if context.use_os_distribution has been called. ---@field homebrew_prefix string @Only available if context.use_homebrew_prefix has been called. ---@field install_dir string @@ -165,10 +167,20 @@ end ---@param installer ServerInstallerFunction|ServerInstallerFunction[] @The installer to execute in a new installer context. function M.branch_context(installer) ---@type ServerInstallerFunction - return function(server, callback, context) - local new_context = vim.deepcopy(context) + return function(server, callback, ctx) + local receipt = ctx.receipt + -- This temporary nil assignment is done to avoid deepcopy traversing the receipt builder unnecessarily + ctx.receipt = nil + local new_context = vim.deepcopy(ctx) + ctx.receipt = receipt + new_context.receipt = receipt normalize_installer(installer)(server, callback, new_context) end end +---@type ServerInstallerFunction +function M.noop(_, callback) + callback(true) +end + return M |
