Skip to content

Commit

Permalink
chore: update some logging (chipsalliance#761)
Browse files Browse the repository at this point in the history
* chore: update some logging

* docs: add section about known errors
  • Loading branch information
williamboman authored Jun 7, 2022
1 parent de94ab4 commit 2b2d214
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
21 changes: 20 additions & 1 deletion doc/nvim-lsp-installer.txt
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,23 @@ GITHUB MIRROR *nvim-lsp-installer-download-mirror-github*
},
}


==============================================================================
INSTALLATION ERRORS *nvim-lsp-installer-errors*

*nvim-lsp-installer-errors-github-api*
For some installers, the GitHub API is used to fetch information about
releases. This API imposes a rate limit that may be triggered, causing
installations to fail. The reasons why a rate limit is triggered are many, for
example being behind a public API, or using other software that also send
requests to the GitHub API.

To circumvent this, nvim-lsp-installer will utilize the GitHub CLI when
available, leading to API requests being subject to a much higher rate limit
threshold when authenticated. Should you run into errors with communicating
with GitHub's API, it's recommended to install, and authenticate, the GitHub
CLI: https://cli.github.com/.

==============================================================================
DEBUGGING *nvim-lsp-installer-debugging*

Expand All @@ -295,7 +312,9 @@ sure to set nvim-lsp-installer's log level to DEBUG or TRACE, like so:
}

You may find the logs by entering the command `:LspInstallLog`. Providing the
contents of this file when reporting an issue will help tremendously.
contents of this file when reporting an issue will help tremendously. Remember
to redo whatever is failing after changing the log level in order to capture
new log entries.

==============================================================================
Lua module: nvim-lsp-installer
Expand Down
2 changes: 1 addition & 1 deletion lua/nvim-lsp-installer/core/managers/github/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function M.release_file(opts)
local release = _.coalesce(opts.version, ctx.requested_version):or_else_get(function()
return client.fetch_latest_release(opts.repo)
:map(_.prop "tag_name")
:get_or_throw "Failed to fetch latest release from GitHub API."
:get_or_throw "Failed to fetch latest release from GitHub API. Refer to :h nvim-lsp-installer-errors-github-api for more information."
end)
---@type string
local asset_file
Expand Down
2 changes: 2 additions & 0 deletions lua/nvim-lsp-installer/core/spawn.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ local Result = require "nvim-lsp-installer.core.result"
local process = require "nvim-lsp-installer.core.process"
local platform = require "nvim-lsp-installer.core.platform"
local functional = require "nvim-lsp-installer.core.functional"
local log = require "nvim-lsp-installer.log"

---@alias JobSpawn table<string, async fun(opts: JobSpawnOpts): Result>
---@type JobSpawn
Expand Down Expand Up @@ -88,6 +89,7 @@ setmetatable(spawn, {
local cmd = self._aliases[normalized_cmd] or normalized_cmd

if (env and env.PATH) == nil and args.check_executable ~= false and not is_executable(cmd) then
log.fmt_debug("%s is not executable", cmd)
return Failure({
stderr = ("%s is not executable"):format(cmd),
}, cmd)
Expand Down
2 changes: 1 addition & 1 deletion lua/nvim-lsp-installer/jobs/outdated-servers/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ function M.identify_outdated_servers(servers, on_result)
end, receipt, server.root_dir)
else
complete(VersionCheckResult.empty(server))
log.fmt_error("Unable to find checker for source=%s", receipt.primary_source.type)
log.fmt_debug("Unable to find checker for source=%s", receipt.primary_source.type)
end
else
complete(VersionCheckResult.empty(server))
Expand Down
2 changes: 1 addition & 1 deletion lua/nvim-lsp-installer/ui/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,7 @@ local function init(all_servers)
state.servers[server.name].installer.is_running = true
end)

log.fmt_info("Starting install server_name=%s, requested_version=%s", server.name, requested_version or "")
log.fmt_debug("Starting install server_name=%s, requested_version=%s", server.name, requested_version or "")

server:install_attached({
requested_server_version = requested_version,
Expand Down

0 comments on commit 2b2d214

Please sign in to comment.