williamboman / nvim-lsp-installer

Further development has moved to https://github.com/williamboman/mason.nvim!
https://github.com/williamboman/mason.nvim
Apache License 2.0
2k stars 123 forks source link

Keep on getting "LSP not installed in path" #601

Closed Suyashtnt closed 2 years ago

Suyashtnt commented 2 years ago

Problem description

Whenever I open up a new file, I always get the error "LSP not installed in path ..." even though it is installed and it works perfectly.

Neovim version (>= 0.6)

glowsquid on  dev [✘!?] via  v16.14.2 via 🦀 v1.59.0
❯ nvim --version
NVIM v0.8.0-dev+3-g3f2e9298b
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Compilation: /usr/bin/cc -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions     -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security     -fstack-clash-protection -fcf-protection -Wp,-U_FORTIFY_SOURCE -Wp,-D_FORTIFY_SOURCE=1 -DNVIM_TS_HAS_SET_MATCH_LIMIT -DNVIM_TS_HAS_SET_ALLOCATOR -O2 -g -Og -g -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=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -DMIN_LOG_LEVEL=3 -I/home/tntman/.cache/paru/clone/neovim-git/src/build/config -I/home/tntman/.cache/paru/clone/neovim-git/src/neovim-git/src -I/usr/include -I/home/tntman/.cache/paru/clone/neovim-git/src/build/src/nvim/auto -I/home/tntman/.cache/paru/clone/neovim-git/src/build/include
Compiled by tntman

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info

Operating system/version

Linux GAMER-PC 5.17.1-arch1-1 #1 SMP PREEMPT Mon, 28 Mar 2022 20:55:33 +0000 x86_64 GNU/Linux

I've recently downloaded the latest plugin version of both nvim-lsp-installer and nvim-lspconfig

Affected language servers

all

Steps to reproduce

I have 0 idea what is causing the issue and it just happens with no real way to say how to reproduce it. So here is my lsp config

require("navigator").setup({
    lsp_installer = true,
})

local nvim_lsp = require("lspconfig")
local lsp_installer = require("nvim-lsp-installer")
local coq = require("coq")

require("coq_3p")({
    { src = "nvimlua", short_name = "nvim" },
    { src = "copilot", short_name = "COP", accept_key = "<c-f>" },
})

local enhance_server_opts = {
    ["sumneko_lua"] = function(options)
        options.on_attach = function(client, bufnr)
            require("navigator.lspclient.mapping").setup({
                client = client,
                bufnr = bufnr,
                cap = client.resolved_capabilities,
            })
        end
        options.settings = {
            Lua = {
                diagnostics = {
                    globals = { "vim" },
                },
            },
        }
    end,
    ["tsserver"] = function(options)
        options.on_attach = function(client, bufnr)
            -- eslint ftw
            client.resolved_capabilities.document_formatting = false
            require("navigator.lspclient.mapping").setup({
                client = client,
                bufnr = bufnr,
                cap = client.resolved_capabilities,
            })
        end
        options.root_dir = nvim_lsp.util.root_pattern("package.json")
    end,
    ["rust_analyzer"] = function(options)
        options.on_attach = function(client, bufnr)
            -- eslint ftw
            client.resolved_capabilities.document_formatting = false
            require("navigator.lspclient.mapping").setup({
                client = client,
                bufnr = bufnr,
                cap = client.resolved_capabilities,
            })
        end
    end,
}

lsp_installer.on_server_ready(function(server)
    local options = {}

    if enhance_server_opts[server.name] then
        -- Enhance the default opts with the server-specific ones
        enhance_server_opts[server.name](options)
    end

    if server.name == "rust_analyzer" then
        -- Initialize the LSP via rust-tools instead
        require("rust-tools").setup({
            -- The "server" property provided in rust-tools setup function are the
            -- settings rust-tools will provide to lspconfig during init.            --
            -- We merge the necessary settings from nvim-lsp-installer (server:get_default_options())
            -- with the user's own settings (opts).
            server = coq.lsp_ensure_capabilities(vim.tbl_deep_extend("force", server:get_default_options(), options)),
        })
        server:attach_buffers()
        -- Only if standalone support is needed
        require("rust-tools").start_standalone_if_required()
    else
        server:setup(coq.lsp_ensure_capabilities(options))
    end
end)

Actual behavior

It to work without warnings

Expected behavior

It works with warnings

LspInfo

Language client log: /home/tntman/.cache/nvim/lsp.log
 Detected filetype:   lua

 2 client(s) attached to this buffer: 

 Client: null-ls (id: 3, pid: 5001, bufnr: [18, 24])
    filetypes:       lua, typescriptreact, javascript, vue, typescript, javascriptreact
    autostart:       false
    root directory:  /home/tntman/.config/nvim
    cmd:             nvim

 Client: sumneko_lua (id: 4, pid: 213112, bufnr: [18, 24])
    filetypes:       lua, lua, lua, lua, lua, lua, lua, lua, lua, lua
    autostart:       true
    root directory:  /home/tntman/.config/nvim
    cmd:             lua-language-server

 2 active client(s) not attached to this buffer: 

 Client: rust_analyzer (id: 1, pid: 212309, bufnr: [1])
    filetypes:       rust, rust, rust, rust, rust, rust, rust, rust, rust, rust, rust, rust, rust
    autostart:       true
    root directory:  /mnt/BulkStorage/projects/glowsquid
    cmd:             rust-analyzer

 Client: rust_analyzer (id: 2, pid: 212823, bufnr: [26])
    filetypes:       rust, rust, rust, rust, rust, rust, rust, rust, rust, rust, rust, rust, rust
    autostart:       true
    root directory:  /home/tntman/.rustup/toolchains/stable-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/alloc
    cmd:             rust-analyzer

 Configured servers list: sumneko_lua, sqls, tsserver, html, svelte, pyright, graphql, gopls, ccls, phpactor, r_language_server, texlab, fsautocomplete, vls, jdtls, hls, bashls, elixirls, omnisharp, clojure_lsp, vuels, terraformls, sourcekit, jsonls, angularls, flow, rust_analyzer, dockerls, julials, pylsp, jedi_language_server, vimls, clangd, solargraph, cssls, yamlls, denols, dartls, dotls, kotlin_language_server, nimls, intelephense

Healthcheck

nvim-lsp-installer: require("nvim-lsp-installer.health").check()
========================================================================
## nvim-lsp-installer report
  - OK: neovim version >= 0.6.0
  - WARNING: **Composer**: not available
  - WARNING: **PHP**: not available
  - WARNING: **julia**: not available
  - 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 brotli/1.0.9 zstd/1.5.2 libidn2/2.3.2 libpsl/0.21.1 (+libidn2/2.3.0) libssh2/1.10.0 nghttp2/1.47.0`
  - OK: **wget**: `GNU Wget 1.21.3 built on linux-gnu.`
  - OK: **python3**: `Python 3.10.4`
  - OK: **node**: `v16.14.2`
  - OK: **Ruby**: `ruby 3.0.3p157 (2021-11-24 revision 3fb7d2cadc) [x86_64-linux]`
  - OK: **Go**: `go version go1.18.1 linux/amd64`
  - OK: **bash**: `GNU bash, version 5.1.16(1)-release (x86_64-pc-linux-gnu)`
  - OK: **sh**: `Ok`
  - WARNING: **pip3**: not available
  - OK: **RubyGem**: `3.3.8`
  - OK: **java**: `Ok`
  - OK: **javac**: `javac 18`
  - OK: **npm**: `8.5.0`

Screenshots or recordings

asciicast

williamboman commented 2 years ago

Hello! Try disabling navigator.lua and see if that works, I believe the error message comes from there. This might also be interesting to read in case you haven't seen it yet: https://github.com/ray-x/navigator.lua/blob/ab96133b471eae64f3e11d87c27505ec60269933/doc/navigator.txt#L460-L487.

Suyashtnt commented 2 years ago

Hello! Try disabling navigator.lua and see if that works, I believe the error message comes from there. This might also be interesting to read in case you haven't seen it yet: https://github.com/ray-x/navigator.lua/blob/ab96133b471eae64f3e11d87c27505ec60269933/doc/navigator.txt#L460-L487.

Can confirm this was the issue, I will look for an alternative to navigator.

Suyashtnt commented 2 years ago

Lspsaga works great for anybody else having this issue