diff options
| author | William Boman <william@redwill.se> | 2022-03-06 12:19:39 +0100 |
|---|---|---|
| committer | William Boman <william@redwill.se> | 2022-03-06 13:06:50 +0100 |
| commit | a28297493810c30edf150cec78c02920e7112cb2 (patch) | |
| tree | 165ae53a747423f990e3f79d298fe4edf74c8086 /lua/nvim-lsp-installer/core/fetch.lua | |
| parent | fix(solang): use llvm13 (diff) | |
| download | mason-a28297493810c30edf150cec78c02920e7112cb2.tar mason-a28297493810c30edf150cec78c02920e7112cb2.tar.gz mason-a28297493810c30edf150cec78c02920e7112cb2.tar.bz2 mason-a28297493810c30edf150cec78c02920e7112cb2.tar.lz mason-a28297493810c30edf150cec78c02920e7112cb2.tar.xz mason-a28297493810c30edf150cec78c02920e7112cb2.tar.zst mason-a28297493810c30edf150cec78c02920e7112cb2.zip | |
fix(fetch): shift args to put callback arg last
Diffstat (limited to 'lua/nvim-lsp-installer/core/fetch.lua')
| -rw-r--r-- | lua/nvim-lsp-installer/core/fetch.lua | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lua/nvim-lsp-installer/core/fetch.lua b/lua/nvim-lsp-installer/core/fetch.lua index 9e5dc7f0..bd1a582d 100644 --- a/lua/nvim-lsp-installer/core/fetch.lua +++ b/lua/nvim-lsp-installer/core/fetch.lua @@ -17,11 +17,14 @@ local function with_headers(headers, args) return result end +---@alias FetchCallback fun(err: string|nil, raw_data: string) + ---@param url string The url to fetch. ----@param callback fun(err: string|nil, raw_data: string) ----@param opts {custom_fetcher: { cmd: string, args: string[] }} -local function fetch(url, callback, opts) - opts = opts or {} +---@param callback_or_opts FetchCallback|{custom_fetcher: { cmd: string, args: string[] }} +---@param callback FetchCallback +local function fetch(url, callback_or_opts, callback) + local opts = type(callback_or_opts) == "table" and callback_or_opts or {} + callback = type(callback_or_opts) == "function" and callback_or_opts or callback local stdio = process.in_memory_sink() log.fmt_debug("Fetching URL %s", url) local on_exit = function(success) |
