fidget.nvim icon indicating copy to clipboard operation
fidget.nvim copied to clipboard

:lua require"fidget".setup{} not working with clangd

Open jsholmes opened this issue 2 years ago • 5 comments

This says it works with clangd, but it doesn't seem to for me. Is there something extra I need to add to the clangd config? I'm already doing clangdFileStatus = true in the init_options

Originally posted by @jsholmes in https://github.com/j-hui/fidget.nvim/issues/17#issuecomment-1185887581

I debuged further according to the docs and found that :lua require"fidget".setup{} does not work in a buffer served by clangd. It prints no error or anything, though.

LUA buffers are working fine, btw and showing the fidget info.

jsholmes avatar Jul 15 '22 20:07 jsholmes

Can you confirm that clangd is working in general? I.e., it can perform other LSP functions like providing hover or goto definition

Also, can you give a minimal project to reproduce your issue?

j-hui avatar Jul 15 '22 22:07 j-hui

Yeah clangd is working fine in general and it was working with lsp-status.

I'll try to put together a minimal config to reproduce the issue soon.

I did find out that even though it appears to be working fine in lua (see screenshot below), when I try lua print(require"fidget".is_installed()) it still prints false, so that seems odd:

Screen Shot 2022-07-15 at 4 53 45 PM

jsholmes avatar Jul 17 '22 14:07 jsholmes

Really it happens with only my lsp config and fidget.nvim. So I'm wondering, what version of clangd have you tried this with? I'm using version 13.0.0.

jsholmes avatar Jul 18 '22 22:07 jsholmes

maybe it is fast on loading for clangd @jsholmes

oeyoews avatar Jul 27 '22 12:07 oeyoews

From #17

@j-hui , clangd works well for me in all other LSP-related activities. goto definition, code completion via cmp, lsp-saga works, etc. It is only fidget that dosen't seem to work with clangd.

Note, i do not have compile_commands,json. Instead, I use compile_flags.txt. (see https://releases.llvm.org/8.0.0/tools/clang/tools/extra/docs/clangd/Installation.html). Perhaps this is the issue?

That may be the issue, though I'm not sure why; I use compile_commands.json and haven't had any problems myself.

j-hui avatar Sep 10 '22 20:09 j-hui

I`m reporting from a user perspective that fidget is not open-box working with clangd from mason for example if I do nvim hello.c, not like other servers such as lua-language-server; gopls; rust-analyzer and Im still confused what I need to do to fire it up after I check the doc.

Redbeard93 avatar Jan 18 '23 12:01 Redbeard93

I did find out that even though it appears to be working fine in lua (see screenshot below), when I try lua print(require"fidget".is_installed()) it still prints false, so that seems odd:

I think this is because now nvim has a built in handler for progress, and fidgets wraps it so that it runs that before its own handler, and the is_installed() method returns false because it only returns true when the handler is only its own handler, not the builtin plus its own

https://github.com/neovim/neovim/blob/8e52d8a394799ede43ae5e80574f12dede9bc13e/runtime/lua/vim/lsp/handlers.lua#L24 https://github.com/j-hui/fidget.nvim/blob/688b4fec4517650e29c3e63cfbb6e498b3112ba1/lua/fidget.lua#L532-L540 https://github.com/j-hui/fidget.nvim/blob/688b4fec4517650e29c3e63cfbb6e498b3112ba1/lua/fidget.lua#L484-L486

So the method is not reliable anymore to check whether the handler is installed: for now I'm in your same situation where I've only seen it working in lua (tried clang, rust-analyzer and pyright), but not sure why it's the case

michelesr avatar Feb 21 '23 23:02 michelesr

Just stopping by to comment that this doesn't seem to be working for me as well. The Lsp Functionally is working though

Ch0ronomato avatar Mar 30 '23 21:03 Ch0ronomato

In my case the issue could be solved by reviewing my lspconfig setup. With the intent of customizing some of the LSP server setting, I ran the setup() method on the clients again, but this time without providing the capabilities that are necessary for things like fidget to work correctly. After sorting out my config taking kickstart.nvim as inspiration, fidget is working absolutely fine with servers installed by Mason.

michelesr avatar Mar 31 '23 10:03 michelesr

The file status extension in clangd does NOT use the progress protocol, so it definitely won't work with fidget.nvim.

What you guys see it "working" is the progress report from clangd's background indexer, which has nothing to do with the file status extension, and I think it does require a compile_command.json.

cairijun avatar Aug 11 '23 18:08 cairijun

Seems to not be Fidget's issue, then. Thanks @cairijun

j-hui avatar Nov 10 '23 01:11 j-hui