question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Javadoc is not displayed when calling CocAction('doHover')

See original GitHub issue

I am using OpenJDK 11 on Debian and have the corresponding doc package installed. Previously, I was getting javadoc info from the OpenJDK doc package when calling CocAction(‘doHover’). Now when I call CocAction('doHover') (using a keymapping or the command prompt) with the cursor on a keyword like String, I do not get the javadoc info from the doc package in the preview window like I did before. Instead I get this: image

This is the information I was seeing before I installed the doc package.

I don’t know if it’s related, but I started having this problem after I applied the fix for #15. Before that, I was getting the correct documentation.

I updated the server from jdt-language-server-0.36.0-201903201910 to jdt-language-server-0.36.1-201904020132 by running :CocCommand java.updateLanguageServer to see if that would fix the issue, but it did not.

This is the trace I get when i try to get the hover info:

[Trace - 3:45:08 PM] Sending request 'textDocument/hover - (5)'.
Params: {
    "textDocument": {
        "uri": "file:///home/user/udemy/maven/mb2g-lombok/src/main/java/guru/springframework/model/User.java"
    },
    "position": {
        "line": 12,
        "character": 14
    }
}


[Trace - 3:45:08 PM] Received response 'textDocument/hover - (5)' in 56ms.
Result: {
    "contents": {
        "language": "java",
        "value": "java.lang.String"
    }
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (4 by maintainers)

github_iconTop GitHub Comments

6reactions
ioperationscommented, Oct 25, 2020

solved by

 sudo apt install openjdk-${VERSION}-source 
0reactions
rajitbanerjeecommented, Mar 16, 2022

I had a similar issue with no hover showing at all until I added this to my vimrc:

function! ShowDocIfNoDiagnostic(timer_id)
  if (coc#float#has_float() == 0 && CocHasProvider('hover') == 1)
    silent call CocActionAsync('doHover')
  endif
endfunction

function! s:show_hover_doc()
  call timer_start(500, 'ShowDocIfNoDiagnostic')
endfunction

autocmd CursorHoldI * :call <SID>show_hover_doc()
autocmd CursorHold * :call <SID>show_hover_doc()

Thanks to https://thoughtbot.com/blog/modern-typescript-and-react-development-in-vim#tool-tip-documentation-and-diagnostics

Read more comments on GitHub >

github_iconTop Results From Across the Web

neoclide/coc.nvim - Gitter
@Annis-Monadjem No matter how K works, If :call CocAction('doHover') can work with minimal vimrc ... Is the installation progress of CoC not shown...
Read more >
doc/coc.txt · izhengfan/coc.nvim - Gitee.com
"doHover" *coc-action-doHover*. Show documentation of the current word in a preview window. Return `v:false` when hover not found. Use `coc.preferences.
Read more >
VIM配置- 骨头- 博客园
Show by default 4 spaces for a tab autocmd BufNewFile,BufRead *.go ... 0) execute 'h '.expand('<cword>') else call CocAction('doHover') ...
Read more >
coc nvim: doHover('...') error : r/neovim - Reddit
[coc.nvim]: Error on "doHover": current buffer 1 not attached. the mapping for K is: :call <SNR>3_show_documentation()<cr>.
Read more >
coc.nvim - Plugins - Vem Text Editor
Display function/method signature. Rename identifier. Show usages of identifier ... Show info mappings nnoremap <silent> Ci :call CocAction('doHover')<CR> ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found