nvim-lspinstall icon indicating copy to clipboard operation
nvim-lspinstall copied to clipboard

Issue with lspinstall.install_server()

Open classPythonAddike opened this issue 3 years ago • 9 comments

I tried to make it simpler to install servers by adding this bit of code to my config -

local lspinstall = require("lspinstall")

local lsp_servers = { "go", "python", "vue", "svelte", "lua", "vim", "cpp" }
local installed_servers = lspinstall.installed_servers()

function Make_set(list)
    local set = {}

	for _, l in ipairs(list)
	do
		set[l] = true
	end

	return set
end

installed_servers = Make_set(installed_servers)

for _, server in ipairs(lsp_servers)
do
	if not installed_servers[server] then
		print("Installing LSP Server for " .. server)
		lspinstall.install_server(server)
	end
end

However, when I open Neovim, but results in a strange error (Even though it installs the lsp server) - image

And all the terminal output is messed up after that. I can't find any issues in my code. Is there a bug I am missing?

classPythonAddike avatar Aug 01 '21 09:08 classPythonAddike

My full config is over here btw - classPythonAddike/NVim-Configuration (If it helps with debugging) :smile:

classPythonAddike avatar Aug 01 '21 09:08 classPythonAddike

Hmm not sure why this is happening. Could you try to wrap this whole code into a function and then manually call it after starting neovim? Does this still happen in this case?

kabouzeid avatar Aug 02 '21 09:08 kabouzeid

I tried that, and on running :lua InstallServers() I got some interesting results -

local lsp_servers = { "go", "python", "vue", "svelte", "lua", "vim" }
local installed_servers = lspinstall.installed_servers()

function Make_set(list)
    local set = {}

	for _, l in ipairs(list)
	do
		set[l] = true
	end

	return set
end

function InstallServers()
	installed_servers = Make_set(installed_servers)

	for _, server in ipairs(lsp_servers)
	do
		if not installed_servers[server] then
			print("Installing LSP Server for " .. server)
			lspinstall.install_server(server)
		end
	end
end

When cpp is in the array of lsp_servers the installation fails. But when I remove cpp from the list, all the servers which aren't installed (vim, lua) are installed properly. I tried installing the C++ language server manually to see if there was a bug in the installation, and :LspInstall cpp works perfectly fine. So I'm not sure why it fails only when cpp is in the list.

classPythonAddike avatar Aug 02 '21 12:08 classPythonAddike

Same here. I've just reinstall nvim recently and I can't install without facing this issue about ui_compositor.c :556 ui_comp_raw_line attrs[i] >= 0 . I see compositor and think about last neovim floating window commits. Could this be related to this ? I see that window opened at LspInstall have a different look compared to the last time I used it

n3wborn avatar Aug 11 '21 15:08 n3wborn

I'm not sure, I can't reproduce this, neither with 0.5.0 nor with latest 0.6.0 :/

kabouzeid avatar Aug 11 '21 16:08 kabouzeid

I also tested using stable (I always use nightly) but same problem :/ I'll try bissecting commits to see where the bug disappear. I'm used to install servers using LspInstall so everything was ok at some time, maybe I'll find something interesting.

n3wborn avatar Aug 11 '21 17:08 n3wborn

Not sure why, but I re-installed nvim from source and everything seems back to normal (NVIM v0.6.0-dev+132-g7d2233fad)

n3wborn avatar Aug 11 '21 22:08 n3wborn

Were you also building from source before?

kabouzeid avatar Aug 12 '21 06:08 kabouzeid

Were you also building from source before?

Nope, I was using nightly AppImage, first time I build it

n3wborn avatar Aug 12 '21 06:08 n3wborn