gfanto / fzf-lsp.nvim

Enable the power of fzf fuzzy search for the neovim built in lsp
MIT License
222 stars 11 forks source link

"no client attached" error #25

Closed igorsol closed 2 years ago

igorsol commented 2 years ago

When I try to execute any fzf-lsp command I get the following error:

LSP: no client attached

Tried this with C++ and Rust code. CocInfo shows that LSP service was successfully started. LSP-based commands and services from other plugins seem to work.

Please help me to debug this issue.

Update: typo in error message fixed

gfanto commented 2 years ago

It's a bit hard with this information, can you please tell me if:

igorsol commented 2 years ago
  • "LSP: no client installed" is this the exact message you receive? because i don't send this message inside the plugin

Sorry, that was a typo. Correct message is "no client attached"

  • if you call the vim command :lua vim.lsp.buf.document_symbol(), what happen? Is it working?

Nothing happens. No visible effects of this command.

  • The language servers are reachable in the PATH? Taking the example of rust, if you call which rust-analyzer it gives you the file path?

Well, rust-analyzer is not on PATH. It is installed by coc-rust-analyzer into ~/.config/coc/extensions/coc-rust-analyzer-data/. But for C++ I use ccls language server and it is on PATH.

gfanto commented 2 years ago

Sorry, that was a typo. Correct message is "no client attached"

So ok, i think the problem should relay on the fact that language server is installed with coc and not in a "standard way" and the neovim lsp system is not able to interact with the language servers. This should not be a problem with fzf-lsp but with the general neovim / system configuration

Nothing happens. No visible effects of this command.

This confirms to me the statement i made before

Well, rust-analyzer is not on PATH. It is installed by coc-rust-analyzer into ~/.config/coc/extensions/coc-rust-analyzer-data/

You can try adding it to the system PATH and see if it works

But for C++ I use ccls language server and it is on PATH.

I'm sorry i'm not used with this language server, they should all behave in the same way but if we stick with rust-analyzer as i'm more familiar to it, it'll be better for debugging

To recap everything the fact that this command :lua vim.lsp.buf.document_symbol() doesn't give you a result confirms to me that the problem is not from the fzf-lsp plugin but a general configuration problem. If you need some help installing the language servers you can try with this plugin: https://github.com/kabouzeid/nvim-lspinstall You can check if the language serve are correctly configured opening a file and launcing the command :LspInfo If you get a result like:


 Language client log: /home/gfanto/.cache/nvim/lsp.log
 Detected filetype:   go

 1 client(s) attached to this buffer: 

 Client: gopls (id: 1, pid: 616803, bufnr: [4, 15, 41])
    filetypes:       go, gomod, gotmpl
    autostart:       true
    root directory:  /home/gfanto/workspace/lamarzocco-gateway-pro
    cmd:             gopls

 Configured servers list: rust_analyzer, tsserver, html, cssls, gopls, clangd, vimls, sumneko_lua, pyright

it should be ok, and fzf-lsp should work.

igorsol commented 2 years ago

Thank you for the detailed response.

I added neovim/nvim-lspconfig plugin to get LspInfo command. This command show that "0 clients attached to the buffer". Obviously LspInfo only knows about language servers installed/configured via Neovim's built-in LSP. In my case I have language servers installed as COC mini plugins.

So fzf-lsp only supports language servers installed via Neovim's builtin LSP.

So to resolve this issue I need to throw out my COC config and create new one based on built-in LSP. Well, maybe I will do this one day when I will have enough time.

gfanto commented 2 years ago

So to resolve this issue I need to throw out my COC config and create new one based on built-in LSP. Well, maybe I will do this one day when I will have enough time.

Yes, unfortunately this is the way to go and, like you said it's a matter of having time to do it.