Comments (6)
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.
well i would definitely prefer that if we can have multiple floating windows in flight :D
from coc-clangd.
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.
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.
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.
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)
- stdint.h Library error HOT 1
- Question: navigate to conflicting item/item causing error? HOT 4
- clangd don't start on windows HOT 1
- Unable to locate C/C++ header files (stdio.h, etc.) HOT 1
- coc-clangd still use c++03 to diagnose HOT 1
- some error flag but the code can running HOT 1
- How do I remove the automatically added parameter label in parentheses? HOT 1
- An issue of including libraries HOT 9
- Duplicate references HOT 2
- Command CocCommand clangd.install fails with error 'Failed to install clangd language server' HOT 5
- 这个插件如何在补全头文件比如#include<iostream>时,光标在>的右边,否则每次都多跳过这个符号一次 HOT 1
- [coc.nvim] Connection to server got closed. Server will not be restarted. HOT 4
- 'iostream' file not found (clang pp_file_not_found) HOT 1
- Connection to server got closed HOT 1
- coc-clangd没有输入头文件的情况下也能补全 HOT 4
- Header file not found, even though autocompletion works and include path is added correctly HOT 5
- MinGW issue HOT 1
- MinGW issue
- It can support like [c-mantic] feature? HOT 1
- Env include path not working in header files HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from coc-clangd.