Coc.nvim: Obtain type under cursor

Created on 12 Jun 2019  路  1Comment  路  Source: neoclide/coc.nvim

Is your feature request related to a problem? Please describe.
I want to know what type is under the cursor at any given time, either automatically or by pressing a hotkey.

Describe the solution you'd like
In VSCode for example you hover and get the type from Intellisense that way - I'm not sure what the Nvim analog to that is. Ideally this information would be exposed in some manner that would allow me to insert it into my status bar, but failing that a hotkey that popped up this info in a manner similar to the diagnostics window would still be helpful.

Describe alternatives you've considered
I've looked to see if this already exists, couldn't find it. There's a good chance it exists and I just don't know the correct Vim terminology to find it... my apologies if that's the case :stuck_out_tongue:

Most helpful comment

example-vim-configuration

" Use K to show documentation in preview window
nnoremap <silent> K :call <SID>show_documentation()<CR>

function! s:show_documentation()
  if (index(['vim','help'], &filetype) >= 0)
    execute 'h '.expand('<cword>')
  else
    call CocAction('doHover')
  endif
endfunction

Read the docs :help Coc
If you want the definition in your status line you will need to learn vimscript.

>All comments

example-vim-configuration

" Use K to show documentation in preview window
nnoremap <silent> K :call <SID>show_documentation()<CR>

function! s:show_documentation()
  if (index(['vim','help'], &filetype) >= 0)
    execute 'h '.expand('<cword>')
  else
    call CocAction('doHover')
  endif
endfunction

Read the docs :help Coc
If you want the definition in your status line you will need to learn vimscript.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MacGuffinLife picture MacGuffinLife  路  4Comments

iago-lito picture iago-lito  路  3Comments

npearson72 picture npearson72  路  3Comments

skylite21 picture skylite21  路  3Comments

rkulla picture rkulla  路  3Comments