diff options
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/nvim-lsp-installer/core/managers/github/client.lua | 9 | ||||
| -rw-r--r-- | lua/nvim-lsp-installer/core/managers/github/init.lua | 5 | ||||
| -rw-r--r-- | lua/nvim-lsp-installer/servers/init.lua | 1 |
3 files changed, 9 insertions, 6 deletions
diff --git a/lua/nvim-lsp-installer/core/managers/github/client.lua b/lua/nvim-lsp-installer/core/managers/github/client.lua index e2d6e977..da0e4302 100644 --- a/lua/nvim-lsp-installer/core/managers/github/client.lua +++ b/lua/nvim-lsp-installer/core/managers/github/client.lua @@ -45,14 +45,17 @@ function M.fetch_release(repo, tag_name) end) end ----@alias FetchLatestGithubReleaseOpts {tag_name_pattern:string} +---@alias FetchLatestGithubReleaseOpts {tag_name_pattern:string|nil, include_prelease: boolean} ---@async ---@param repo string @The GitHub repo ("username/repo"). ---@param opts FetchLatestGithubReleaseOpts|nil ---@return Result @of GitHubRelease function M.fetch_latest_release(repo, opts) - opts = opts or {} + opts = opts or { + tag_name_pattern = nil, + include_prelease = false, + } return M.fetch_releases(repo):map_catching( ---@param releases GitHubRelease[] function(releases) @@ -60,7 +63,7 @@ function M.fetch_latest_release(repo, opts) local latest_release = list_find_first( ---@param release GitHubRelease function(release) - local is_stable_release = not release.prerelease and not release.draft + local is_stable_release = (release.prerelease and opts.include_prelease) and not release.draft if opts.tag_name_pattern then return is_stable_release and release.tag_name:match(opts.tag_name_pattern) end diff --git a/lua/nvim-lsp-installer/core/managers/github/init.lua b/lua/nvim-lsp-installer/core/managers/github/init.lua index 87947447..58856b66 100644 --- a/lua/nvim-lsp-installer/core/managers/github/init.lua +++ b/lua/nvim-lsp-installer/core/managers/github/init.lua @@ -42,8 +42,9 @@ function M.release_file(opts) if not asset_file then error( ( - "Could not find which release file to download. Most likely the current operating system, architecture (%s), or libc (%s) is not supported." - ):format(platform.arch, platform.get_libc()) + "Could not find which release file to download.\nMost likely the current operating system, architecture (%s), or libc (%s) is not supported." + ):format(platform.arch, platform.get_libc()), + 0 ) end local download_url = ("https://github.com/%s/releases/download/%s/%s"):format(opts.repo, release, asset_file) diff --git a/lua/nvim-lsp-installer/servers/init.lua b/lua/nvim-lsp-installer/servers/init.lua index 7ae84eb1..8e721619 100644 --- a/lua/nvim-lsp-installer/servers/init.lua +++ b/lua/nvim-lsp-installer/servers/init.lua @@ -1,6 +1,5 @@ local functional = require "nvim-lsp-installer.core.functional" local path = require "nvim-lsp-installer.core.path" -local a = require "nvim-lsp-installer.core.async" local fs = require "nvim-lsp-installer.core.fs" local settings = require "nvim-lsp-installer.settings" local log = require "nvim-lsp-installer.log" |
