-
-
Notifications
You must be signed in to change notification settings - Fork 107
[Bug?] Lsp servers fail to start #87
Comments
Hey, sorry for the late reply! What happens if you do (e.g. for tsserver) :lua print(vim.inspect(require("lspconfig")["typescript"].filetypes)) |
No worries!
I tried running {
_root = {
_setup = <function 1>,
commands = {
LspInfo = { <function 2>, "-nargs=0",
description = "`:LspInfo` Displays attached, active, and configured language servers"
},
LspRestart = { <function 3>, "-nargs=? -complete=customlist,v:lua.lsp_get_active_client_ids",
description = "`:LspRestart` Manually restart the given language client."
},
LspStart = { <function 4>, "-nargs=? -complete=custom,v:lua.lsp_complete_configured_servers",
description = "`:LspStart` Manually launches a language server."
},
LspStop = { <function 5>, "-nargs=? -complete=customlist,v:lua.lsp_get_active_client_ids",
description = "`:LspStop` Manually stops the given language client."
}
}
},
available_servers = <function 6>,
util = {
add_hook_after = <function 7>,
add_hook_before = <function 8>,
create_module_commands = <function 9>,
default_config = {
autostart = true,
handlers = {},
init_options = vim.empty_dict(),
log_level = 2,
message_level = 2,
settings = vim.empty_dict()
},
find_git_ancestor = <function 10>,
find_node_modules_ancestor = <function 11>,
find_package_json_ancestor = <function 12>,
has_bins = <function 13>,
path = {
dirname = <function 14>,
exists = <function 15>,
is_absolute = <function 16>,
is_descendant = <function 17>,
is_dir = <function 18>,
is_file = <function 19>,
iterate_parents = <function 20>,
join = <function 21>,
sep = "/",
traverse_parents = <function 22>
},
root_pattern = <function 23>,
script_path = <function 24>,
search_ancestors = <function 25>,
server_per_root_dir_manager = <function 26>,
validate_bufnr = <function 27>
},
<metatable> = {
__index = <function 28>
}
} There doesn't seem to be lsp servers installed? I'm not sure |
By the way, I just figured out that running For debugging the original issue though, I will uninstall & reinstall everything so that this won't affect debugging 👍 |
Hmm that's pretty strange. Maybe the server wasn't installed properly? Don't know but hey, at least it's working now! I'll try to dig on it too by reinstalling my servers, hopefully if there's an error I should be able to get it so I can start debugging :) |
I've been investigating this issue myself and I think I found the source. It seems as if -- install_servers will install the language servers for the languages with
-- the +lsp flag.
--
-- @param langs The list of languages in the doomrc
M.install_servers = function(langs)
log.info("Installing servers")
log.info("packer_plugins[\"nvim-lspinstall\"].loaded: " .. string.format("%s", packer_plugins["nvim-lspinstall"].loaded))
-- This if statement fails as loaded == false
if packer_plugins and packer_plugins["nvim-lspinstall"] and packer_plugins["nvim-lspinstall"].loaded then
local lspinstall = require("lspinstall")
local installed_servers = lspinstall.installed_servers()
local available_servers = lspinstall.available_servers()
I've been trying to solve this but I'm pretty new to lua and nvim config in general so not sure what the best solution is. It'd be great to be able to attach a callback to trigger once packer loads a plugin. Alternatively we could put Here's a log showing the race condition If you can point me in the right direction for a solution I'm happy to put in a PR :)
|
Hi, thank you for digging on this and also for providing such useful information! Now I think I know what could be happening. Can you please try modifying Doom's plugins setup? It's at
Since lspinstall is being loaded right after lspconfig then lspinstall should load before the Otherwise if you don't want to stop lazy-loading lspconfig because it could increase startup time by a lot because there's a ton of stuff lazy-loaded to be loaded after lspconfig, you can change how is lspinstall lazy-loaded. So, you could use Additional to this change you could remove the |
Hmm I tried modifying the packer use part like you described -- provides the missing `:LspInstall` for `nvim-lspconfig`.
use({
"kabouzeid/nvim-lspinstall",
config = require("doom.modules.config.doom-lspinstall"),
disable = disabled_lsp,
module = 'lspinstall',
}) But this just pushed the issue down to Could we keep the same |
Hi, yeah this sounds like a better approach :) |
Description
Running
:LspInfo
in various filetypes shows that LSP does not start.Reproduce
Using:
Configs:
'html', 'css', 'javascript +lsp', 'typescript +lsp', 'tsx', 'rust +lsp'
Steps:
js
,tsx
, orrs
):LspInfo
Any debugging ideas appreciated :)
The text was updated successfully, but these errors were encountered: