Vim is my main editor but for typescript it's hard to see what the inferred type of a variable is. Whether it is a complex type or just a simple one, it'd be great to see the typescript inferred type

Asked here but no response https://github.com/Quramy/tsuquyomi/issues/297


If you use coc.nvim then you can look at their FAQ...it actually doesn't suggest the CursorHold+doHover but this is what I wanted

I can now click on a variable and it pops up a float window

" This makes the time before it updates your hover faster, other
set updatetime=300

" This makes it so that you can click a variable and a float window pops up
autocmd CursorHold * silent call CocActionAsync('doHover')

Output from my :CocInfo

vim version: NVIM v0.5.0-dev+1028-g702208daa
node version: v15.2.1
coc.nvim version: 0.0.80-79b07c7867
coc.nvim directory: /home/cdiesh/.local/share/nvim/plugged/coc.nvim
term: screen-256color
platform: linux

Look at the FAQ from coc.nvim for more tips but this minimal set of additions was enough for me

enter image description here

  • Note that after some time, I accepted the recommendation from the coc.nvim FAQ and now have their config to press shift+k (e.g. capital K) to produce a type definition instead of cursor hold + doHover – Colin D Apr 4 at 4:25
  • Specific line: nnoremap <silent> K :call <SID>show_documentation()<CR> – Colin D Apr 4 at 4:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.