-
-
Notifications
You must be signed in to change notification settings - Fork 123
Unable to install language servers with modified install_root_dir #621
Comments
Hello! Hm I can't really repro this. It almost seems like it has mixed up two different install root dirs, might be some race condition going on. Is this 100% reproducable? Does this happen if you for example have opened a buffer (say a |
I've installed the rolling branch of LunarVim and I can't reproduce this :/. Do you have some custom config? |
weird nuked my config.lua and just used the example lunarvim one and tested some other servers like For ccls, I now appear to be getting a different error when compiling from source. here's the LspInstall printout for that
|
ah figured out a repro for the original issue, require("lvim.lsp.manager").setup("ccls", {}) adding this line to the lunarvim config some how messes everything else up. I guess that's technically a lunarvim issue? |
Ah that ccls issue seems like a nvim-lsp-installer problem. Could you try again with branch
|
I made a change recently which overrives I think the issue is some transient state, or cache-related validation which is causing this. |
install log from fix/ccls-linux with debug enabled |
I think I'm having the same issue with two other Lsp Here's my LunarVim config for the Lsp: local cmd = {
"node",
"/home/gfs/.nvm/versions/node/v14.18.2/lib/node_modules/@angular/language-server",
"--stdio",
"--tsProbeLocations",
project_library_path,
"--ngProbeLocations",
project_library_path,
}
require("lvim.lsp.manager").setup("angularls", {
cmd = cmd,
on_new_config = function(new_config, new_root_dir)
new_config.cmd = cmd
end,
})
require("lvim.lsp.manager").setup("tailwindcss") LunarVim/Nvim-lsp-installer Error: Error executing vim.schedule lua callback: ...r/start/nvim-lsp-installer/lua/nvim-lsp-installer/fs.lua:11: Refusing to operate on path (/home/gfs/.local/share/l
unarvim/lsp_servers/angularls/nvim-lsp-installer-receipt.json) outside of the servers root dir (/home/gfs/.local/share/nvim/lsp_servers).
stack traceback:
[C]: in function 'error'
...r/start/nvim-lsp-installer/lua/nvim-lsp-installer/fs.lua:11: in function 'assert_ownership'
...r/start/nvim-lsp-installer/lua/nvim-lsp-installer/fs.lua:107: in function 'read_file'
...art/nvim-lsp-installer/lua/nvim-lsp-installer/server.lua:207: in function 'get_receipt'
...er/lua/nvim-lsp-installer/jobs/outdated-servers/init.lua:57: in function 'fn'
.../nvim-lsp-installer/lua/nvim-lsp-installer/jobs/pool.lua:21: in function 'dequeued'
.../nvim-lsp-installer/lua/nvim-lsp-installer/jobs/pool.lua:33: in function '_dequeue'
.../nvim-lsp-installer/lua/nvim-lsp-installer/jobs/pool.lua:24: in function 'supply'
...er/lua/nvim-lsp-installer/jobs/outdated-servers/init.lua:49: in function 'identify_outdated_servers'
...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:869: in function 'identify_outdated_servers'
...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:909: in function ''
vim/_editor.lua: in function ''
vim/_editor.lua: in function <vim/_editor.lua:0> |
made a lunarvim issue for the weird cache issue |
I'm not really sure what's going on here, but if I have to guess the settings are getting read a bit too late, or are out of sync How to reproduce
{
"williamboman/nvim-lsp-installer",
disable = not use_lsp_installer,
config = function()
require("nvim-lsp-installer").settings {
install_root_dir = "/tmp/lsp_servers",
}
end,
},
local _, s = require("nvim-lsp-installer.servers").get_server("sumneko_lua"); print(s.root_dir)
-- > "/home/hatsu/.local/share/nvim/lsp_servers/sumneko_lua" vs print(require("nvim-lsp-installer.setings").current.install_root_dir)
-- > "/tmp/lsp_servers" minimal_init.lualocal on_windows = vim.loop.os_uname().version:match "Windows"
local function join_paths(...)
local path_sep = on_windows and "\\" or "/"
local result = table.concat({ ... }, path_sep)
return result
end
vim.cmd [[set runtimepath=$VIMRUNTIME]]
local temp_dir = vim.loop.os_getenv "TEMP" or "/tmp"
vim.cmd("set packpath=" .. join_paths(temp_dir, "nvim", "site"))
local package_root = join_paths(temp_dir, "nvim", "site", "pack")
local install_path = join_paths(package_root, "packer", "start", "packer.nvim")
local compile_path = join_paths(install_path, "plugin", "packer_compiled.lua")
-- Choose whether to use the executable that's managed by lsp-installer
local use_lsp_installer = true
local function load_plugins()
require("packer").startup {
{
"wbthomason/packer.nvim",
"neovim/nvim-lspconfig",
{
"williamboman/nvim-lsp-installer",
disable = not use_lsp_installer,
config = function()
require("nvim-lsp-installer").settings {
install_root_dir = "/tmp/lsp_servers",
}
end,
},
},
config = {
package_root = package_root,
compile_path = compile_path,
},
}
end
function _G.dump(...)
local objects = vim.tbl_map(vim.inspect, { ... })
print(unpack(objects))
return ...
end
_G.load_config = function()
vim.lsp.set_log_level "trace"
require("vim.lsp.log").set_format_func(vim.inspect)
local nvim_lsp = require "lspconfig"
local on_attach = function(_, bufnr)
local function buf_set_keymap(...)
vim.api.nvim_buf_set_keymap(bufnr, ...)
end
local function buf_set_option(...)
vim.api.nvim_buf_set_option(bufnr, ...)
end
buf_set_option("omnifunc", "v:lua.vim.lsp.omnifunc")
-- Mappings.
local opts = { noremap = true, silent = true }
buf_set_keymap("n", "gD", "<Cmd>lua vim.lsp.buf.declaration()<CR>", opts)
buf_set_keymap("n", "gd", "<Cmd>lua vim.lsp.buf.definition()<CR>", opts)
buf_set_keymap("n", "K", "<Cmd>lua vim.lsp.buf.hover()<CR>", opts)
buf_set_keymap("n", "gi", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts)
buf_set_keymap("n", "<C-k>", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts)
buf_set_keymap("n", "<space>wa", "<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>", opts)
buf_set_keymap("n", "<space>wr", "<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>", opts)
buf_set_keymap("n", "<space>wl", "<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>", opts)
buf_set_keymap("n", "<space>lD", "<cmd>lua vim.lsp.buf.type_definition()<CR>", opts)
buf_set_keymap("n", "<space>lr", "<cmd>lua vim.lsp.buf.rename()<CR>", opts)
buf_set_keymap("n", "gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts)
buf_set_keymap("n", "gl", "<cmd>lua vim.diagnostic.open_float(0,{scope='line'})<CR>", opts)
buf_set_keymap("n", "<space>lk", "<cmd>lua vim.diagnostic.goto_prev()<CR>", opts)
buf_set_keymap("n", "<space>lj", "<cmd>lua vim.diagnostic.goto_next()<CR>", opts)
buf_set_keymap("n", "<space>lq", "<cmd>lua vim.diagnostic.setloclist()<CR>", opts)
buf_set_keymap("n", "<space>li", "<cmd>LspInfo<CR>", opts)
buf_set_keymap("n", "<space>lI", "<cmd>LspInstallInfo<CR>", opts)
end
-- Add the server that troubles you here, e.g. "sumneko_lua", "pyright", "tsserver"
local name = "sumneko_lua"
-- You need to specify the server's command manually
local cmd_env
if use_lsp_installer then
local server_available, server = require("nvim-lsp-installer.servers").get_server(name)
if not server_available then
server:install()
end
local default_opts = server:get_default_options()
cmd_env = default_opts.cmd_env
end
nvim_lsp[name].setup {
cmd_env = cmd_env,
on_attach = on_attach,
}
end
if vim.fn.isdirectory(install_path) == 0 then
vim.fn.system { "git", "clone", "https://github.com/wbthomason/packer.nvim", install_path }
load_plugins()
require("packer").sync()
vim.cmd [[autocmd User PackerComplete ++once lua load_config()]]
else
load_plugins()
require("packer").sync()
_G.load_config()
end |
Hm, haven't debugged this yet but I'd almost assume that Packer ends up executing the I'm fairly confident it's not a problem if either the settings are provided at the beginning of the |
I'm having a similar issue with |
@williamboman, this is probably already fixed by #631, since it's now required to call |
Similar issue with |
I think the problem arises from the fact that LunarVim calls the user config before calling diff --git a/init.lua b/init.lua
index cd7c659..a59e99e 100644
--- a/init.lua
+++ b/init.lua
@@ -7,6 +7,8 @@ end
require("lvim.bootstrap"):init(base_dir)
+require("lvim.lsp").setup()
+
require("lvim.config"):load()
local plugins = require "lvim.plugins"
@@ -17,5 +19,3 @@ Log:debug "Starting LunarVim"
local commands = require "lvim.core.commands"
commands.load(commands.defaults)
-
-require("lvim.lsp").setup()
|
oh I see what you mean, but it's hard to change this order. otherwise the user-config would be completely ignored, e.g. you can probably close this issue once you're happy with the behavior with a |
FWIW, the fact that the server instances themselves host the full path to the installation directory the moment it's instantiated is an implementation detail that I'd like to get rid off, to avoid races like these. Full paths will in the future be constructed at the moment of installation |
That would be perfect! and it's inline with abstracting the installer away from setting up the servers. I was trying to think of a useful return value to the install operation, it should probably be something along the lines of but maybe include the full receipt nvim-lsp-installer/lua/nvim-lsp-installer/jobs/version-check/init.lua Lines 56 to 71 in 40442b6
|
Problem description
I am trying to install ccls and sumneko_lua with this using LunarVim which modifies the install_root_dir and it fails to install.
Neovim version (>= 0.6)
NVIM v0.8.0-dev+3-g3f2e9298b-dirty
Build type: Gentoo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/x86_64-pc-linux-gnu-gcc -mtune=generic -O2 -pipe -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -Wimplicit-fallthrough -Wsuggest-attribute=pure -Wsuggest-attribute=const -Wsuggest-attribute=malloc -Wsuggest-attribute=cold -Wvla -fstack-protector-strong -fno-common -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/var/tmp/portage/app-editors/neovim-9999/work/neovim-9999_build/config -I/var/tmp/portage/app-editors/neovim-9999/work/neovim-9999/src -I/usr/include -I/var/tmp/portage/app-editors/neovim-9999/work/neovim-9999_build/src/nvim/auto -I/var/tmp/portage/app-editors/neovim-9999/work/neovim-9999_build/include
Compiled by portage@localhost
Features: +acl +iconv +tui
See ":help feature-compile"
system vimrc file: "/etc/vim/sysinit.vim"
fall-back for $VIM: "/usr/share/nvim"
Run :checkhealth for more info
Operating system/version
Linux computer 5.16.19-gentoo-dist-hardened #1 SMP PREEMPT Sat Apr 9 21:39:09 EDT 2022 x86_64 AMD Ryzen 9 3950X 16-Core Processor AuthenticAMD GNU/Linux
I've recently downloaded the latest plugin version of both nvim-lsp-installer and nvim-lspconfig
Affected language servers
all
Actual behavior
When using a non-default install_root_dir (such as with LunarVim), the installers gets confused with which directory to use and it tries to operate on the wrong one.
Expected behavior
The installers should correctly use the directory specified by install_root_dir
LspInstallInfo output
Installation log
Healthcheck
Screenshots
No response
The text was updated successfully, but these errors were encountered: