`get_installed_servers()` does not return all installed servers when starting up Neovim
kamalsacranie opened this issue · 5 comments
Problem description
I refer to
require("nvim-lsp-installer")
aslsp_installer
for brevity.
I use lsp_installer.get_installed_servers()
when setting up LSP and use the name table entry for each one to dynamically create a list of installed LSP clients. I run the following when initialising nvim:
...
local servers = {}
for i, server in ipairs(require("nvim-lsp-installer").get_installed_servers()) do
servers[i] = server.name
end
...
I know that I have the servers { "texlab", "bashls", "pyright", "html", "grammarly", "prosemd_lsp", "r_language_server", "sumneko_lua", "emmet_ls" }
installed (included in screenshot) but when using the above code print(vim.insepct(servers))
(run after the for
loop above) yields the output of only
{ "html", "grammarly", "prosemd_lsp", "r_language_server", "sumneko_lua", "emmet_ls" }
I.e., function get_installed_servers()
does not return all servers I have installed.
Interestingly, when I am in the LSP file which sets up my server and run :so %
, the function then yields all the correct servers. I.e., once Neovim has completely initialised and I have entered the buffer, the functions works as intended.
Hopefully you can reproduce this error and that it is not a problem with my cofig :laughing
Neovim version (>= 0.7)
NVIM v0.8.0-dev+1470-g0124a7bfa
Operating system/version
Darwin User-MacBook-Pro.local 21.2.0 Darwin Kernel Version 21.2.0: Sun Nov 28 20:28:41 PST 2021
I've recently downloaded the latest plugin version of both nvim-lsp-installer and nvim-lspconfig
- Yes
Affected language servers
At least pyright, bashes, texlab
Actual behavior
require("nvim-lsp-installer").get_installed_servers()
does not return all installed servers when starting up Neovim
Expected behavior
require("nvim-lsp-installer").get_installed_servers()
should return all installed servers
Healthcheck output
nvim-lsp-installer: require("nvim-lsp-installer.health").check()
========================================================================
## nvim-lsp-installer report
- OK: neovim version >= 0.7.0
- WARNING: **Composer**: not available
- WARNING: **PHP**: not available
- WARNING: **julia**: not available
- OK: **bash**: `GNU bash, version 3.2.57(1)-release (arm64-apple-darwin21)`
- OK: **tar**: `bsdtar 3.5.1 - libarchive 3.5.1 zlib/1.2.11 liblzma/5.0.5 bz2lib/1.0.8 `
- OK: **gzip**: `Apple gzip 352.40.6`
- OK: **curl**: `curl 7.77.0 (x86_64-apple-darwin21.0) libcurl/7.77.0 (SecureTransport) LibreSSL/2.8.3 zlib/1.2.11 nghttp2/1.42.0`
- OK: **wget**: `GNU Wget 1.21.3 built on darwin21.3.0.`
- OK: **node**: `v18.2.0`
- OK: **Ruby**: `ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]`
- OK: **sh**: `Ok`
- OK: **Go**: `go version go1.18.2 darwin/arm64`
- WARNING: **java**: not available
- WARNING: **javac**: not available
- OK: **python3**: `Python 3.9.13`
- OK: **python3_host_prog**: `Python 3.9.13`
- OK: **RubyGem**: `3.0.3.1`
- OK: **npm**: `8.9.0`
- OK: **cargo**: `cargo 1.60.0 (d1fd9fe2c 2022-03-01)`
- OK: **pip3**: `pip 22.1.1 from /opt/homebrew/lib/python3.9/site-packages/pip (python 3.9)`
- OK: GitHub API rate limit. Used: 6. Remaining: 4994. Limit: 5000. Reset: Fri 3 Jun 23:36:09 2022.
Screenshots
Hello! Hmm, I'm unable to reproduce this. Could you set the log level to TRACE
and provide the trace logs:
:LspInstallLog
:%!grep 'TRACE'
:%y
You'll need to change the trace log level :h nvim-lsp-installer-debugging
require("nvim-lsp-installer").setup {
log_level = vim.log.levels.TRACE
}
I just realised!! how embarrassing...
I was calling require("nvim-lsp-installer").setup()
after trying to get the server names. When I set TRACE
on I called setup()
before the require("nvim-lsp-installer").get_installed_servers()
call.
Calling setup before fixed the issue. Sorry for the waste of time!!
Ah cool! Bit weird, as calling setup shouldn't have any impact on what those functions return. Let's reopen if you run into issues again
@williamboman I'm actually having a similar problem. Calling require('nvim-lsp-installer').get_installed_servers()
returns nil
for me.
NVIM v0.8.0-dev+474-gc00a3f45d
macOS 12.4