-
-
Notifications
You must be signed in to change notification settings - Fork 955
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to make pum and signatureHelp floating window mutually exclusive #990
Comments
This hasn't been fixed at all... :-( |
You can use autocmd |
Sounds cool, I tried this to check how it works but I never get any message: autocmd vimrc User CocOpenFloat if exists('w:popup') | echom 'popup' | else | echom 'no popup' | endif | if exists('w:float') | echom 'float' | else | echom 'no float' | endif I'm trying to understand when |
It's a silent autocmd, can be improved. |
No idea how to close ( Besides that, just a thought to make sure of behavior since I couldn't try it yet, I'm expecting this event is triggered before current popups/windows are displayed, to avoid any confusion on hiding the current ones (doesn't make sense to immediately hide something that just got displayed). |
You can iterate all windows
No, it's triggered just after float window displayed, it's neovim only, the current window id would be the opened float window, you can just check it. |
It's possible signature help shown after preview window of pum, so you might want to hide it. |
OK, I'll try iterate.
I think that could be put in |
I think autocmd vimrc User CocOpenFloat
\ if exists('t:previous_window') && nvim_win_is_valid(t:previous_window)
\| call nvim_win_close(t:previous_window, v:false)
\| unlet t:previous_window
\| endif
\ if exists('w:float')
\| let t:previous_window = win_getid()
\| endif It doesn't work because in the gif I was left with a signature floating window open and when started typing after it, completion pum shows up, without hiding signature, but pum display doesn't trigger |
No, it's fired on preview window open, all you need is check |
The former problem is having signature floating window closed when a pum window gets open, for not having code covered both bellow and down. It was not about the preview window that's shown on completion selection, in the gif I didn't select anything at the end, but that's indeed an additional scenery I didn't think of, like the following: But it's not what I mentioned first. Here there's 3 windows floating (1 pum + 2 floating window), which can be reduced from 3 to 2, but initially I talked about reducing from 2 (1 floating down + 1 pum up) to 1 (pum XOR floating). |
Use |
oh, I didn't know about that event, it's not yet in my nvim docs. Finally, I think this is doing what I wanted: autocmd vimrc User CocOpenFloat
\ if !exists('w:popup')
\| let t:last_signature_help = win_getid()
\| endif
autocmd vimrc CompleteChanged *
\ if exists('t:last_signature_help')
\| if nvim_win_is_valid(t:last_signature_help)
\| call nvim_win_close(t:last_signature_help, v:false)
\| endif
\| unlet t:last_signature_help
\| endif |
It works, but if you have any idea of something more simple or clean, I'd like to know about :) |
Above solution won't work after 4e72e5b. |
@chemzqm any tip how to achieve the same as above after the latest changes? |
|
@chemzqm thx. I'm calling that function at |
Use it with CocOpenFloat autocmd |
@chemzqm Like as Still no effect. |
Not sure whether you're following me here but I don't want both completion pum and signature help float open at the same time, that's why Tried this too but it didn't work either: autocmd vimrc CompleteChanged * call coc#util#close_pum_float() |
With this new api I can fix the problem and does what I'm requesting on this issue: autocmd vimrc CompleteChanged * call coc#util#float_hide() |
For anyone coming to this issue, the api has changed so you need to call: autocmd CompleteChanged * call coc#float#close_all() |
Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
I don't like too many floating windows covering big part of surrounding code.
Describe the solution you'd like
A clear and concise description of what you want to happen.
My wish is that I can have at a time only one of the windows open: pum for completion XOR signatureHelp window. I'm not sure this can be accomplished but the idea is that for when one of the two is going to be shown, it will call a command to hide the other.
Another thing to consider too in this context of options for how and which windows may be displayed regards the documentation window that's shown besides signatureHelp. Is there an option to disable it?
Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.
I'm currently using
call coc#config('signature', {'preferShownAbove': v:false})
to great effect, since the side effect of showing signatureHelp bellow is that it causes most of time the pum to be hidden (because it also prefers to shown bellow), and vice-versa, making them mutually exclusive. But this does not work always, if I'm typing at the bottom of the window, pum most certainly will be shown above (because there's no room for it bellow), but signatureHelp will stay open bellow (because there was room for it), besides that, in fact, preferring signatureHelp bellow or above is a feature of its own which should not be confused with window hiding (reason why this happens).The text was updated successfully, but these errors were encountered: