Implementation provider not found for current document, although definition is found
See original GitHub issueI have been looking for info on this everywhere, without much success so far, so I am opening this issue.
I just installed coc, clangd and coc-clangd on a fresh nvim install and configured keybinds, etc. and I have the following keybinds in my init.vim:
nmap <silent> gd <Plug>(coc-definition) nmap <silent> gy <Plug>(coc-type-definition) nmap <silent> gi <Plug>(coc-implementation) nmap <silent> gr <Plug>(coc-references)
I am able to go to the definition of any function, be it my own or one in a library. However, I am unable go to the function’s implementation. Whenever I do, I get the error message “Implementation provider not found for current document” (it looks like this if that is any useful). I feel like when I’m able to find the definition of the function, I should also be able to find its implementation.
Logs I wasn’t able to get any meaningful information from either coc or clangd log.
System information Clangd version : 10.0.1 coc.nvim version: 0.0.78-9f9d8a32c4 Operating system: linux
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (3 by maintainers)
Top GitHub Comments
I found out that if both Foo.cpp and Foo.h are parsed, “gd” will go back and forth between implementation and declaration among the two files. Since Foo.h is usually included in Foo.cpp, there is no issue if Foo.cpp is being opened. However, if only Foo.h is being opened, you will not find the implementation from coc-definition.
Right now, I can manually switch to Foo.cpp by using clangd.switchSourceHeader and go back to search again to find the implementation. It is kind of annoying however. Is there a way to activate the Foo.cpp parsing automatically or ask coc-clangd to do it in the background?
Just to emphasize this in case it’s helpful to others: @tao-guo 's comment is extremely helpful. I hope that a lot of people trying to jump to the implementation find this, because it wasn’t obvious to me that
gi
wouldn’t work but multiple callsgd
would shift between declaration and implementation: