Giter Site home page Giter Site logo

Comments (6)

sam-mccall avatar sam-mccall commented on June 12, 2024

Fairly sure this needs to be fixed in coc itself.

It might make sense to always put the signature first, and then put documentation below it.

Do you mean signature above documentation inside the floating window?
That may end up with the signature a few lines away from the code, and they compete for space.
I think I'd prefer having the signatures in a float above the current line, and the docs in a separate float below it. (Downside is we cover up more of the code) WDYT?

from coc-clangd.

kadircet avatar kadircet commented on June 12, 2024

well i would definitely prefer that if we can have multiple floating windows in flight :D

from coc-clangd.

sam-mccall avatar sam-mccall commented on June 12, 2024

At a technical level, certainly possible:

:call popup_create(["one","two"], #{pos: 'botleft', line: 'cursor-1', col:'cursor'})
:call popup_create(["three","four"], #{pos: 'topleft', line: 'cursor+1', col:'cursor'})

Would need some changes - I think another FloatFactory in handler/index.ts.

from coc-clangd.

fannheyward avatar fannheyward commented on June 12, 2024

Maybe we should short the signature document from server. Usually, I don't use floating window to show signature, use echo instead. We should not abuse the floating window.

from coc-clangd.

oblitum avatar oblitum commented on June 12, 2024

These are my relevant confs which may be of interest for your issues with how floats show. First, where it's displayed by default is as it is to resemble how VSCode do it, but personally I don't like it, for example I don't like signatureHelp at the top, nor both signatureHelp and completion showing at the same time. You may do the same from jsonc conf, I prefer it all from .vimrc:

call coc#config('signature', {
\   'preferShownAbove': v:false
\ })

function! s:coc_close_floats() abort
  for i in range(1, winnr('$'))
    if getwinvar(i, 'float')
      call coc#util#close_win(win_getid(i))
    endif
  endfor
endfunction
autocmd vimrc CompleteChanged * call s:coc_close_floats()

For more info on that check discussion at neoclide/coc.nvim#990.

from coc-clangd.

oblitum avatar oblitum commented on June 12, 2024

For NeoVim, I also have float scrolling from keyboard setup, so I don't have to touch mouse to scroll docs in the event I need it.

" INSERT mode floating window scrolling {{{
function! s:coc_float_scroll(forward) abort
  let float = coc#util#get_float()
  if !float | return '' | endif
  let buf = nvim_win_get_buf(float)
  let buf_height = nvim_buf_line_count(buf)
  let win_height = nvim_win_get_height(float)
  if buf_height < win_height | return '' | endif
  let pos = nvim_win_get_cursor(float)
  if a:forward
    if pos[0] == 1
      let pos[0] += 3 * win_height / 4
    elseif pos[0] + win_height / 2 + 1 < buf_height
      let pos[0] += win_height / 2 + 1
    endif
    let pos[0] = pos[0] < buf_height ? pos[0] : buf_height
  else
    if pos[0] == buf_height
      let pos[0] -= 3 * win_height / 4
    elseif pos[0] - win_height / 2 + 1  > 1
      let pos[0] -= win_height / 2 + 1
    endif
    let pos[0] = pos[0] > 1 ? pos[0] : 1
  endif
  call nvim_win_set_cursor(float, pos)
  return ''
endfunction
" }}}

nnoremap <silent><expr> <down> coc#util#has_float() ? coc#util#float_scroll(1) : "\<down>"
nnoremap <silent><expr> <up> coc#util#has_float() ? coc#util#float_scroll(0) : "\<up>"
inoremap <silent><expr> <down> coc#util#has_float() ? <SID>coc_float_scroll(1) : "\<down>"
inoremap <silent><expr> <up> coc#util#has_float() ? <SID>coc_float_scroll(0) : "\<up>"
vnoremap <silent><expr> <down> coc#util#has_float() ? <SID>coc_float_scroll(1) : "\<down>"
vnoremap <silent><expr> <up> coc#util#has_float() ? <SID>coc_float_scroll(0) : "\<up>"

This discussion provides a technique for Vim: neoclide/coc.nvim#1405.

from coc-clangd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.