Skip to content
This repository has been archived by the owner on Nov 12, 2022. It is now read-only.

Unable to install language servers with modified install_root_dir #621

Closed
1 task done
Ninja3047 opened this issue Apr 22, 2022 · 18 comments
Closed
1 task done

Unable to install language servers with modified install_root_dir #621

Ninja3047 opened this issue Apr 22, 2022 · 18 comments

Comments

@Ninja3047
Copy link

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

  • Yes

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

Installed servers (0) 
  
  Pending servers (2) 
    ◍ ccls (failed)
        ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/core/fs.lua:36: Refusing to rmrf "/home/user/.local/share/lunarvim/lsp_servers/ccls.tmp" which is outside of the allowed boundary "/home/user/.local/share/nvim/lsp_servers". Please report this error at https://github.com/williamboman/nvim-lsp-installer/issues/new
        
    ◍ sumneko_lua (failed)
        ...taller/lua/nvim-lsp-installer/core/installer/context.lua:113: "/home/user/.local/share/lunarvim/lsp_servers/sumneko_lua.tmp" is not a subdirectory of "/home/user/.local/share/nvim/lsp_servers"

Installation log

[INFO  Thu 21 Apr 2022 11:07:24 PM EDT] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:682: Starting install server_name="ccls", requested_version=""
[INFO  Thu 21 Apr 2022 11:07:32 PM EDT] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:682: Starting install server_name="ccls", requested_version=""
[ERROR Thu 21 Apr 2022 11:07:32 PM EDT] ...installer/lua/nvim-lsp-installer/core/installer/init.lua:79: Installation failed, name="ccls", error='...rt/nvim-lsp-installer/lua/nvim-lsp-installer/core/fs.lua:36: Refusing to rmrf "/home/user/.local/share/lunarvim/lsp_servers/ccls.tmp" which is outside of the allowed boundary "/home/user/.local/share/nvim/lsp_servers". Please report this error at https://github.com/williamboman/nvim-lsp-installer/issues/new'
[INFO  Thu 21 Apr 2022 11:07:32 PM EDT] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:701: Installation completed server_name="ccls", success=false
[INFO  Thu 21 Apr 2022 11:40:22 PM EDT] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:682: Starting install server_name="ccls", requested_version=""
[ERROR Thu 21 Apr 2022 11:40:22 PM EDT] ...installer/lua/nvim-lsp-installer/core/installer/init.lua:79: Installation failed, name="ccls", error='...rt/nvim-lsp-installer/lua/nvim-lsp-installer/core/fs.lua:36: Refusing to rmrf "/home/user/.local/share/lunarvim/lsp_servers/ccls.tmp" which is outside of the allowed boundary "/home/user/.local/share/nvim/lsp_servers". Please report this error at https://github.com/williamboman/nvim-lsp-installer/issues/new'
[INFO  Thu 21 Apr 2022 11:40:22 PM EDT] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:701: Installation completed server_name="ccls", success=false
[INFO  Thu 21 Apr 2022 11:40:22 PM EDT] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:682: Starting install server_name="sumneko_lua", requested_version=""
[ERROR Thu 21 Apr 2022 11:40:22 PM EDT] ...installer/lua/nvim-lsp-installer/core/installer/init.lua:79: Installation failed, name="sumneko_lua", error='...taller/lua/nvim-lsp-installer/core/installer/context.lua:113: "/home/user/.local/share/lunarvim/lsp_servers/sumneko_lua.tmp" is not a subdirectory of "/home/user/.local/share/nvim/lsp_servers"'

Healthcheck

nvim-lsp-installer: require("nvim-lsp-installer.health").check()
========================================================================
## nvim-lsp-installer report
  - OK: neovim version >= 0.6.0
  - WARNING: **Ruby**: not available
  - WARNING: **RubyGem**: not available
  - WARNING: **Composer**: not available
  - WARNING: **PHP**: not available
  - WARNING: **julia**: not available
  - OK: **bash**: `GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)`
  - OK: **tar**: `tar (GNU tar) 1.34`
  - OK: **gzip**: `gzip 1.12`
  - OK: **curl**: `curl 7.82.0 (x86_64-pc-linux-gnu) libcurl/7.82.0 OpenSSL/1.1.1n zlib/1.2.12 c-ares/1.18.1 nghttp2/1.47.0`
  - OK: **wget**: `GNU Wget 1.21.3 built on linux-gnu.`
  - OK: **python3**: `Python 3.9.12`
  - OK: **node**: `v16.14.1`
  - OK: **Go**: `go version go1.18.1 linux/amd64`
  - OK: **sh**: `Ok`
  - OK: **cargo**: `cargo 1.62.0-nightly (e2e2ddd 2022-04-05)`
  - OK: **java**: `Ok`
  - OK: **javac**: `javac 11.0.14`
  - OK: **npm**: `8.5.0`
  - OK: **pip3**: `pip 22.0.4 from /usr/lib/python3.9/site-packages/pip (python 3.9)`

Screenshots

No response

@williamboman
Copy link
Owner

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 .lua file) and then try installing a server?

@williamboman
Copy link
Owner

I've installed the rolling branch of LunarVim and I can't reproduce this :/. Do you have some custom config?

@Ninja3047
Copy link
Author

weird nuked my config.lua and just used the example lunarvim one and tested some other servers like sumneko_lua, rust_analyzer, and clangd and all worked fine except ccls still doesn't quite work. They all are getting installed to ~/.local/share/nvim/lsp_servers which i think is correct.

For ccls, I now appear to be getting a different error when compiling from source.

here's the LspInstall printout for that
it's compiling from source which might make a difference

  Pending servers (1) 
    ◍ ccls (failed)
        Downloading file "https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/function: 0x7f4204305070"...
        Cloning into '.'...
        Submodule 'third_party/rapidjson' (https://github.com/Tencent/rapidjson) registered for path 'third_party/rapidjson'
        Cloning into '/home/user/.local/share/nvim/lsp_servers/ccls.tmp/ccls-git/third_party/rapidjson'...
        Submodule path 'third_party/rapidjson': checked out '6a905f9311f82d306da77bd963ec5aa5da07da9c'
        Submodule 'thirdparty/gtest' (https://github.com/google/googletest.git) registered for path 'third_party/rapidjson/thirdparty/gtest'
        Cloning into '/home/user/.local/share/nvim/lsp_servers/ccls.tmp/ccls-git/third_party/rapidjson/thirdparty/gtest'...
        Submodule path 'third_party/rapidjson/thirdparty/gtest': checked out '0a439623f75c029912728d80cb7f1b8b48739ca4'
        CMake Warning:
          No source or binary directory provided.  Both will be assumed to be the
          same as the current working directory, but note that this warning will
          become a fatal error in future CMake releases.
        
        
        -- The CXX compiler identification is GNU 11.2.1
        -- The C compiler identification is GNU 11.2.1
        -- Detecting CXX compiler ABI info
        -- Detecting CXX compiler ABI info - done
        -- Check for working CXX compiler: /usr/bin/c++ - skipped
        -- Detecting CXX compile features
        -- Detecting CXX compile features - done
        -- Detecting C compiler ABI info
        -- Detecting C compiler ABI info - done
        -- Check for working C compiler: /usr/bin/cc - skipped
        -- Detecting C compile features
        -- Detecting C compile features - done
        -- Performing Test HAVE_FFI_CALL
        -- Performing Test HAVE_FFI_CALL - Success
        -- Found FFI: /usr/lib64/libffi.so  
        -- Performing Test Terminfo_LINKABLE
        -- Performing Test Terminfo_LINKABLE - Success
        -- Found Terminfo: /usr/lib64/libtinfo.so  
        -- Found ZLIB: /usr/lib64/libz.so (found version "1.2.12") 
        -- Looking for pthread.h
        -- Looking for pthread.h - found
        -- Performing Test CMAKE_HAVE_LIBC_PTHREAD
        -- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
        -- Found Threads: TRUE  
        -- Using local RapidJSON
        -- Configuring done
        fatal: No names found, cannot describe anything.
        -- Generating done
        -- Build files have been written to: /home/user/.local/share/nvim/lsp_servers/ccls.tmp/ccls-git
        [  2%] Building CXX object CMakeFiles/ccls.dir/third_party/siphash.cc.o
        [  4%] Building CXX object CMakeFiles/ccls.dir/src/clang_tu.cc.o
        [  6%] Building CXX object CMakeFiles/ccls.dir/src/config.cc.o
        [  9%] Building CXX object CMakeFiles/ccls.dir/src/filesystem.cc.o
        [ 11%] Building CXX object CMakeFiles/ccls.dir/src/fuzzy_match.cc.o
        [ 13%] Building CXX object CMakeFiles/ccls.dir/src/main.cc.o
        [ 16%] Building CXX object CMakeFiles/ccls.dir/src/include_complete.cc.o
        [ 18%] Building CXX object CMakeFiles/ccls.dir/src/indexer.cc.o
        [ 20%] Building CXX object CMakeFiles/ccls.dir/src/log.cc.o
        [ 23%] Building CXX object CMakeFiles/ccls.dir/src/lsp.cc.o
        [ 25%] Building CXX object CMakeFiles/ccls.dir/src/message_handler.cc.o
        [ 27%] Building CXX object CMakeFiles/ccls.dir/src/pipeline.cc.o
        [ 30%] Building CXX object CMakeFiles/ccls.dir/src/platform_posix.cc.o
        [ 32%] Building CXX object CMakeFiles/ccls.dir/src/platform_win.cc.o
        [ 34%] Building CXX object CMakeFiles/ccls.dir/src/position.cc.o
        [ 37%] Building CXX object CMakeFiles/ccls.dir/src/project.cc.o
        [ 39%] Building CXX object CMakeFiles/ccls.dir/src/query.cc.o
        In file included from /home/user/.local/share/nvim/lsp_servers/ccls.tmp/ccls-git/src/indexer.hh:6,
                         from /home/user/.local/share/nvim/lsp_servers/ccls.tmp/ccls-git/src/query.hh:6,
                         from /home/user/.local/share/nvim/lsp_servers/ccls.tmp/ccls-git/src/query.cc:4:
        In constructor ‘ccls::SymbolInformation::SymbolInformation(ccls::SymbolInformation&&)’,
            inlined from ‘constexpr std::_Optional_payload_base<_Tp>::_Storage<_Up, false>::_Storage(std::in_place_t, _Args&& ...) [with _Args = {ccls::SymbolInformation}; _Up = ccls::SymbolInformation; _Tp = ccls::SymbolInformation]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/include/g++-v11/optional:226:8,
            inlined from ‘constexpr std::_Optional_payload_base<_Tp>::_Optional_payload_base(std::in_place_t, _Args&& ...) [with _Args = {ccls::SymbolInformation}; _Tp = ccls::SymbolInformation]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/include/g++-v11/optional:117:4,
            inlined from ‘constexpr std::_Optional_payload<ccls::SymbolInformation, true, false, false>::_Optional_payload(std::in_place_t, _Args&& ...) [with _Args = {ccls::SymbolInformation}][inherited from std::_Optional_payload_base<ccls::SymbolInformation>]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/include/g++-v11/optional:359:42,
            inlined from ‘constexpr std::_Optional_payload<ccls::SymbolInformation, false, false, false>::_Optional_payload(std::in_place_t, _Args&& ...) [with _Args = {ccls::SymbolInformation}][inherited from std::_Optional_payload_base<ccls::SymbolInformation>]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/include/g++-v11/optional:393:57,
            inlined from ‘constexpr std::_Optional_base<_Tp, <anonymous>, <anonymous> >::_Optional_base(std::in_place_t, _Args&& ...) [with _Args = {ccls::SymbolInformation}; typename std::enable_if<is_constructible_v<_Tp, _Args ...>, bool>::type <anonymous> = false; _Tp = ccls::SymbolInformation; bool <anonymous> = false; bool <anonymous> = false]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/include/g++-v11/optional:483:4,
            inlined from ‘constexpr std::optional<_Tp>::optional(_Up&&) [with _Up = ccls::SymbolInformation; typename std::enable_if<__and_v<std::__not_<std::is_same<std::optional<_Tp>, typename std::remove_cv<typename std::remove_reference<_Up>::type>::type> >, std::__not_<std::is_same<std::in_place_t, typename std::remove_cv<typename std::remove_reference<_Up>::type>::type> >, std::is_constructible<_Tp, _Up>, std::is_convertible<_Up, _Tp> >, bool>::type <anonymous> = true; _Tp = ccls::SymbolInformation]’ at /usr/lib/gcc/x86_64-pc-linux-gnu/11.2.1/include/g++-v11/optional:706:47,
            inlined from ‘std::optional<ccls::SymbolInformation> ccls::getSymbolInfo(ccls::DB*, ccls::SymbolIdx, bool)’ at /home/user/.local/share/nvim/lsp_servers/ccls.tmp/ccls-git/src/query.cc:779:12:
        /home/user/.local/share/nvim/lsp_servers/ccls.tmp/ccls-git/src/lsp.hh:179:8: warning: ‘info.ccls::SymbolInformation::kind’ may be used uninitialized [-Wmaybe-uninitialized]
          179 | struct SymbolInformation {
              |        ^~~~~~~~~~~~~~~~~
        /home/user/.local/share/nvim/lsp_servers/ccls.tmp/ccls-git/src/query.cc: In function ‘std::optional<ccls::SymbolInformation> ccls::getSymbolInfo(ccls::DB*, ccls::SymbolIdx, bool)’:
        /home/user/.local/share/nvim/lsp_servers/ccls.tmp/ccls-git/src/query.cc:770:23: note: ‘info’ declared here
          770 |     SymbolInformation info;
              |                       ^~~~
        [ 41%] Building CXX object CMakeFiles/ccls.dir/src/sema_manager.cc.o
        [ 44%] Building CXX object CMakeFiles/ccls.dir/src/serializer.cc.o
        [ 46%] Building CXX object CMakeFiles/ccls.dir/src/test.cc.o
        [ 48%] Building CXX object CMakeFiles/ccls.dir/src/utils.cc.o
        [ 51%] Building CXX object CMakeFiles/ccls.dir/src/working_files.cc.o
        [ 53%] Building CXX object CMakeFiles/ccls.dir/src/messages/ccls_call.cc.o
        [ 55%] Building CXX object CMakeFiles/ccls.dir/src/messages/ccls_info.cc.o
        [ 58%] Building CXX object CMakeFiles/ccls.dir/src/messages/ccls_inheritance.cc.o
        [ 60%] Building CXX object CMakeFiles/ccls.dir/src/messages/ccls_member.cc.o
        [ 62%] Building CXX object CMakeFiles/ccls.dir/src/messages/ccls_navigate.cc.o
        [ 65%] Building CXX object CMakeFiles/ccls.dir/src/messages/ccls_reload.cc.o
        [ 67%] Building CXX object CMakeFiles/ccls.dir/src/messages/ccls_vars.cc.o
        [ 69%] Building CXX object CMakeFiles/ccls.dir/src/messages/initialize.cc.o
        [ 72%] Building CXX object CMakeFiles/ccls.dir/src/messages/textDocument_code.cc.o
        [ 74%] Building CXX object CMakeFiles/ccls.dir/src/messages/textDocument_completion.cc.o
        [ 76%] Building CXX object CMakeFiles/ccls.dir/src/messages/textDocument_definition.cc.o
        [ 79%] Building CXX object CMakeFiles/ccls.dir/src/messages/textDocument_did.cc.o
        [ 81%] Building CXX object CMakeFiles/ccls.dir/src/messages/textDocument_foldingRange.cc.o
        [ 83%] Building CXX object CMakeFiles/ccls.dir/src/messages/textDocument_formatting.cc.o
        [ 86%] Building CXX object CMakeFiles/ccls.dir/src/messages/textDocument_document.cc.o
        [ 88%] Building CXX object CMakeFiles/ccls.dir/src/messages/textDocument_hover.cc.o
        [ 90%] Building CXX object CMakeFiles/ccls.dir/src/messages/textDocument_references.cc.o
        [ 93%] Building CXX object CMakeFiles/ccls.dir/src/messages/textDocument_rename.cc.o
        [ 95%] Building CXX object CMakeFiles/ccls.dir/src/messages/textDocument_signatureHelp.cc.o
        [ 97%] Building CXX object CMakeFiles/ccls.dir/src/messages/workspace.cc.o
        [100%] Linking CXX executable ccls
        [100%] Built target ccls
        Install the project...
        -- Install configuration: "Release"
        -- Installing: /home/user/.local/share/nvim/lsp_servers/ccls.tmp/bin/ccls
        -- Set runtime path of "/home/user/.local/share/nvim/lsp_servers/ccls.tmp/bin/ccls" to ""
        ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/core/fs.lua:48: rmrf: Could not remove directory "/home/user/.local/share/nvim/lsp_servers/ccls.tmp/llvm".

@Ninja3047
Copy link
Author

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?

@williamboman
Copy link
Owner

weird nuked my config.lua and just used the example lunarvim one and tested some other servers like sumneko_lua, rust_analyzer, and clangd and all worked fine except ccls still doesn't quite work. They all are getting installed to ~/.local/share/nvim/lsp_servers which i think is correct.

Ah that ccls issue seems like a nvim-lsp-installer problem. Could you try again with branch fix/ccls-linux. Also, before you install, could you set the log level to DEBUG and provide the installation logs once completed?

:lua require("nvim-lsp-installer").settings { log_level = vim.log.levels.DEBUG }

@kylo252
Copy link
Contributor

kylo252 commented Apr 22, 2022

I made a change recently which overrives vim.fn.stdpath("data") but I was careful to pass install_root_dir to avoid any problems, see LunarVim/LunarVim@e0f100c (#2477)

I think the issue is some transient state, or cache-related validation which is causing this.

@Ninja3047
Copy link
Author

[DEBUG Fri 22 Apr 2022 10:29:31 AM EDT] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:729: Queuing server="ccls", version="" for installation
[INFO  Fri 22 Apr 2022 10:29:31 AM EDT] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:682: Starting install server_name="ccls", requested_version=""
[DEBUG Fri 22 Apr 2022 10:29:31 AM EDT] ...installer/lua/nvim-lsp-installer/core/installer/init.lua:59: Executing installer for name="ccls"
[DEBUG Fri 22 Apr 2022 10:29:31 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/core/fs.lua:69: fs: mkdirp /home/user/.local/share/nvim/lsp_servers/ccls.tmp
[DEBUG Fri 22 Apr 2022 10:29:31 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:117: Spawning cmd="bash", spawn_opts={
  args = { "-c", "cat /etc/*-release" }
}
[DEBUG Fri 22 Apr 2022 10:29:31 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:163: Spawned with pid 90447
[DEBUG Fri 22 Apr 2022 10:29:31 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:149: Job pid=90447 exited with exit_code=0, signal=0
[DEBUG Fri 22 Apr 2022 10:29:31 AM EDT] ...nvim-lsp-installer/lua/nvim-lsp-installer/core/fetch.lua:22: Fetching URL "https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/function: 0x7fe85bcd98d0"
[DEBUG Fri 22 Apr 2022 10:29:31 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:117: Spawning cmd="wget", spawn_opts={
  args = { "--header", "User-Agent: nvim-lsp-installer (+https://github.com/williamboman/nvim-lsp-installer)", "-nv", "-O", "/home/user/.local/share/nvim/lsp_servers/ccls.tmp/archive.tar.xz", "https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/function: 0x7fe85bcd98d0" }
}
[DEBUG Fri 22 Apr 2022 10:29:31 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:163: Spawned with pid 90448
[DEBUG Fri 22 Apr 2022 10:29:31 AM EDT] ...r/start/nvim-lsp-installer/lua/nvim-lsp-installer/fs.lua:106: fs: read_file "/home/user/.local/share/nvim/lsp_servers/sumneko_lua/nvim-lsp-installer-receipt.json"
[DEBUG Fri 22 Apr 2022 10:29:31 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:117: Spawning cmd="gh", spawn_opts={
  args = { "api", "repos/sumneko/vscode-lua/releases" }
}
[ERROR Fri 22 Apr 2022 10:29:31 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:153: Failed to spawn process. cmd="gh", err="ENOENT: no such file or directory"
[DEBUG Fri 22 Apr 2022 10:29:31 AM EDT] ...nvim-lsp-installer/lua/nvim-lsp-installer/core/fetch.lua:22: Fetching URL "https://api.github.com/repos/sumneko/vscode-lua/releases"
[DEBUG Fri 22 Apr 2022 10:29:31 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:117: Spawning cmd="wget", spawn_opts={
  args = { "--header", "User-Agent: nvim-lsp-installer (+https://github.com/williamboman/nvim-lsp-installer)", "-nv", "-O", "-", "https://api.github.com/repos/sumneko/vscode-lua/releases" }
}
[DEBUG Fri 22 Apr 2022 10:29:31 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:163: Spawned with pid 90450
[DEBUG Fri 22 Apr 2022 10:29:31 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:149: Job pid=90448 exited with exit_code=8, signal=0
[DEBUG Fri 22 Apr 2022 10:29:31 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:117: Spawning cmd="curl", spawn_opts={
  args = { "-H", "User-Agent: nvim-lsp-installer (+https://github.com/williamboman/nvim-lsp-installer)", "-fsSL", "-o", "/home/user/.local/share/nvim/lsp_servers/ccls.tmp/archive.tar.xz", "https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/function: 0x7fe85bcd98d0" }
}
[DEBUG Fri 22 Apr 2022 10:29:31 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:163: Spawned with pid 90451
[DEBUG Fri 22 Apr 2022 10:29:31 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:149: Job pid=90451 exited with exit_code=3, signal=0
[DEBUG Fri 22 Apr 2022 10:29:31 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/core/fs.lua:42: fs: rmrf /home/user/.local/share/nvim/lsp_servers/ccls.tmp/llvm
[DEBUG Fri 22 Apr 2022 10:29:31 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/core/fs.lua:47: fs: rmrf failed
[DEBUG Fri 22 Apr 2022 10:29:31 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/core/fs.lua:62: fs: mkdir /home/user/.local/share/nvim/lsp_servers/ccls.tmp/ccls-git
[DEBUG Fri 22 Apr 2022 10:29:31 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:117: Spawning cmd="git", spawn_opts={
  args = { "clone", "--depth", "1", "--recursive", "https://github.com/MaskRay/ccls", "." },
  cwd = "/home/user/.local/share/nvim/lsp_servers/ccls.tmp/ccls-git"
}
[DEBUG Fri 22 Apr 2022 10:29:31 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:163: Spawned with pid 90452
[DEBUG Fri 22 Apr 2022 10:29:32 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:149: Job pid=90450 exited with exit_code=0, signal=0
[DEBUG Fri 22 Apr 2022 10:29:32 AM EDT] ...r/lua/nvim-lsp-installer/core/managers/github/client.lua:77: Resolved latest version repo="sumneko/vscode-lua", tag_name="v3.1.0"
[DEBUG Fri 22 Apr 2022 10:29:35 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:149: Job pid=90452 exited with exit_code=0, signal=0
[DEBUG Fri 22 Apr 2022 10:29:36 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:117: Spawning cmd="cmake", spawn_opts={
  args = { "-DCMAKE_BUILD_TYPE=Release", "-DUSE_SYSTEM_RAPIDJSON=OFF", "-DCMAKE_FIND_FRAMEWORK=LAST", "-Wno-dev", "-DCMAKE_INSTALL_PREFIX=/home/user/.local/share/nvim/lsp_servers/ccls.tmp" },
  cwd = "/home/user/.local/share/nvim/lsp_servers/ccls.tmp/ccls-git"
}
[DEBUG Fri 22 Apr 2022 10:29:36 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:163: Spawned with pid 90533
[DEBUG Fri 22 Apr 2022 10:29:36 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:149: Job pid=90533 exited with exit_code=0, signal=0
[DEBUG Fri 22 Apr 2022 10:29:36 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:117: Spawning cmd="make", spawn_opts={
  args = { "install" },
  cwd = "/home/user/.local/share/nvim/lsp_servers/ccls.tmp/ccls-git"
}
[DEBUG Fri 22 Apr 2022 10:29:36 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:163: Spawned with pid 90616
[DEBUG Fri 22 Apr 2022 10:31:57 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/process.lua:149: Job pid=90616 exited with exit_code=0, signal=0
[DEBUG Fri 22 Apr 2022 10:31:57 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/core/fs.lua:42: fs: rmrf /home/user/.local/share/nvim/lsp_servers/ccls.tmp/ccls-git
[DEBUG Fri 22 Apr 2022 10:31:57 AM EDT] ...installer/lua/nvim-lsp-installer/core/installer/init.lua:74: Finalizing installer for name="ccls"
[ERROR Fri 22 Apr 2022 10:31:57 AM EDT] ...installer/lua/nvim-lsp-installer/core/installer/init.lua:20: Failed to build receipt for installation="ccls", error="...im-lsp-installer/lua/nvim-lsp-installer/core/receipt.lua:95: primary_source is required"
[DEBUG Fri 22 Apr 2022 10:31:57 AM EDT] ...taller/lua/nvim-lsp-installer/core/installer/context.lua:155: Promoting cwd "/home/user/.local/share/nvim/lsp_servers/ccls.tmp" to "/home/user/.local/share/nvim/lsp_servers/ccls"
[DEBUG Fri 22 Apr 2022 10:31:57 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/core/fs.lua:62: fs: mkdir /home/user/.local/share/nvim/lsp_servers/ccls
[DEBUG Fri 22 Apr 2022 10:31:57 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/core/fs.lua:83: fs: rename /home/user/.local/share/nvim/lsp_servers/ccls.tmp /home/user/.local/share/nvim/lsp_servers/ccls
[DEBUG Fri 22 Apr 2022 10:31:57 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/core/fs.lua:42: fs: rmrf /home/user/.local/share/nvim/lsp_servers/ccls.tmp
[DEBUG Fri 22 Apr 2022 10:31:57 AM EDT] ...rt/nvim-lsp-installer/lua/nvim-lsp-installer/core/fs.lua:47: fs: rmrf failed
[INFO  Fri 22 Apr 2022 10:31:57 AM EDT] ...-installer/lua/nvim-lsp-installer/ui/status-win/init.lua:701: Installation completed server_name="ccls", success=true

install log from fix/ccls-linux with debug enabled

@gfsd3v
Copy link

gfsd3v commented Apr 22, 2022

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>

image

@Ninja3047
Copy link
Author

made a lunarvim issue for the weird cache issue

@kylo252
Copy link
Contributor

kylo252 commented Apr 23, 2022

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
(see the minimal_init.lua as below)

  1. set a different root directory install_root_dir
{
  "williamboman/nvim-lsp-installer",
  disable = not use_lsp_installer,
  config = function()
    require("nvim-lsp-installer").settings {
      install_root_dir = "/tmp/lsp_servers",
    }
  end,
},
  1. see that the server still actually works, even though it shouldn't have been installed yet.. 😅
    even :LspInstallInfo shows 0 installed
  2. compare the outputs of:
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.lua
local 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

@williamboman
Copy link
Owner

Hm, haven't debugged this yet but I'd almost assume that Packer ends up executing the config function provided for nvim-lsp-installer after the _G.load_config() executes? If yes, the custom settings will be applied after the first interaction with nvim-lsp-installer (at which point any instantiated server instances will use the default install path).

I'm fairly confident it's not a problem if either the settings are provided at the beginning of the _G.load_config() function instead of via a Packer config function, or interactions with nvim-lsp-installer are deferred until Packer has executed the config function?

@reisnobre
Copy link

I'm having a similar issue with tailwindcss for some reason.

@kylo252
Copy link
Contributor

kylo252 commented Apr 28, 2022

@williamboman, this is probably already fixed by #631, since it's now required to call setup() before any further interaction 😃

@PasiBergman
Copy link

Similar issue with omnisharp language server.

@williamboman
Copy link
Owner

williamboman commented Apr 29, 2022

@williamboman, this is probably already fixed by #631, since it's now required to call setup() before any further interaction 😃

I think the problem arises from the fact that LunarVim calls the user config before calling nvim-lsp-installer's setup? If the user config contain any interaction with lvim.lsp.manager (e.g. lvim.lsp.manager.setup()), nvim-lsp-installer will instantiate the provided server here, at which point that server will be bound to whatever the install_root_dir is at that moment. This all happens before LunarVim calls require("nvim-lsp-installer").setup {}, no?

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()

@kylo252
Copy link
Contributor

kylo252 commented Apr 29, 2022

I think the problem arises from the fact that LunarVim calls the user config before calling nvim-lsp-installer's setup? If the user config contain any interaction with lvim.lsp.manager (e.g. lvim.lsp.manager.setup()), nvim-lsp-installer will instantiate the provided server [here]
(https://github.com/williamboman/LunarVim/blob/e81d24e3c34cc9718b74de3c0f294c53fcbe82a8/lua/lvim/lsp/manager.lua#L78), at which point that server will be bound to whatever the install_root_dir is at that moment. This all happens before LunarVim calls require("nvim-lsp-installer").setup {}, no?

oh I see what you mean, but it's hard to change this order.

otherwise the user-config would be completely ignored, e.g.
https://github.com/LunarVim/LunarVim/blob/e81d24e3c34cc9718b74de3c0f294c53fcbe82a8/lua/lvim/lsp/init.lua#L137-L139, I've reverted the problematic overload that has caused this inconsistency in the first place.

you can probably close this issue once you're happy with the behavior with a minimal_init.lua

@williamboman
Copy link
Owner

williamboman commented Apr 30, 2022

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

@kylo252
Copy link
Contributor

kylo252 commented Apr 30, 2022

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

---@async
---@param server Server
---@return Result
function M.check_server_version(server)
local receipt = server:get_receipt()
if not receipt then
return Result.failure "Unable to retrieve installation receipt."
end
local version_check = version_checker[receipt.primary_source.type] or noop
local ok, result = pcall(version_check, server, receipt)
if ok then
return result
else
return Result.failure(result)
end
end

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

6 participants