lsp_signature.nvim
lsp_signature.nvim copied to clipboard
float win covers code & flickering
Hello,
In general it works just fine and I love this lsp signature however recently I found myself dealing with two situations that I'm unsure whether they mean any bug or misconfiguration.
- Depending on terminal size and the method signature size, the border covers the line I'm editing. I defined a keybinding to toggle the signature off however it keeps poping up.
- When I'm changing certain pieces of code (mostly strings) the signature popup starts flickering since it starts updating its internal values.
https://user-images.githubusercontent.com/29671981/168479628-bc939a37-7970-47c0-ae72-f08c6b87f540.mp4
My config.
lua <<EOF
cfg = {
bind = true, -- This is mandatory, otherwise border config won't get registered.
-- If you want to hook lspsaga or other signature handler, pls set to false
doc_lines = 10, -- will show two lines of comment/doc(if there are more than two lines in doc, will be truncated);
-- set to 0 if you DO NOT want any API comments be shown
-- This setting only take effect in insert mode, it does not affect signature help in normal
-- mode, 10 by default
floating_window_above_cur_line = true,
focusable = false,
padding = ' ',
floating_window = true, -- show hint in a floating window, set to false for virtual text only mode
fix_pos = false, -- set to true, the floating window will not auto-close until finish all parameters
hint_enable = true, -- virtual hint enable
hint_prefix = "🐼 ", -- Panda for parameter
hint_scheme = "myHint",
use_lspsaga = false, -- set to true if you want to use lspsaga popup
hi_parameter = "hiParameter", -- how your parameter will be highlight
max_height = 12, -- max height of signature floating_window, if content is more than max_height, you can scroll down
-- to view the hiding contents
max_width = 120, -- max_width of signature floating_window, line will be wrapped if exceed max_width
always_trigger = false, -- sometime show signature on new line or in middle of parameter can be confusing, set it to false for #58
auto_close_after = nil, -- autoclose signature float win after x sec, disabled if nil.
extra_trigger_chars = {}, -- Array of extra characters that will trigger signature completion, e.g., {"(", ","}
zindex = 200, -- by default it will be on top of all floating windows, set to 50 send it to bottom
debug = false, -- set to true to enable debug logging
log_path = "debug_log_file_path", -- debug log path
padding = '', -- character to pad on left and right of signature can be ' ', or '|' etc
transparency = nil, -- disabled by default, allow floating win transparent value 1~100
shadow_blend = 36, -- if you using shadow as border use this set the opacity
shadow_guibg = 'Black', -- if you using shadow as border use this set the color e.g. 'Green' or '#121315'
timer_interval = 200, -- default timer check interval set to lower value if you want to reduce latency
toggle_key = '<C-o>'-- toggle signature on and off in insert mode, e.g. toggle_key = '<M-x>'
}
require'lsp_signature'.on_attach(cfg, bufnr)
EOF
I suspect the float win issue happens because of the border but I'm wondering if theres any workaround for that. And the flickering doesn't happen all the time, it only happens when I go back to some part of the code and try to change it, that's when it starts updating the internal value in the popup.
I'm running 0.8-dev and latest lsp_signature 2496aac
Thanks
I was playing around with floating_window_above_cur_line which helps but doesn't solve it, the same thing happens depending on which line I'm in and the size of the signature that pops up.
Disabling the max width / height seems to help, I'm not sure but it seems the float (or popup) is adjusting itself to the terminal size. Is this a thing?
Also something else I was wondering, besides the toggle keybinding is there any option to bind a "disable" key?
I can confirm the issue on my end too (using default configuration - no customization, just dropped the require('lsp_signature').on_attach() line in my lsp shared on_attach)
https://user-images.githubusercontent.com/551858/169643551-fd49f41b-4675-4d9b-bb12-6fde2a63e1fe.mp4
This is a known issue, you can use toggle_key to hide floating win.
I think the toggle_key isn't enough, or perhaps it's not working as expected in my setup.
If you noticed ~0:06 in the vid I posted, when it was covering the code I used the toggle_key to disable it but shortly it came back covering it again.
Was it supposed to say hidden / disabled? If yes I might be missing something in my setup.
put floating_window_off_y = 0 in config
Hey ..
It seems to me changing to zero didn't help.
Honestly I'm not even using floating_window anymore, I had work to do so I did the obvious, disabled it. I'm now using only "hint", it's enough for me and doesn't cover curr line.
I just enabled it again and gave it a try, changed to zero, however the window still covers my current line.
how about floating_window_off_y = -1? Also how about disabling the floatwin border?
TBH, I am a bit surprise to me that it still covers the current line. Might be something different between your setup and mine.
@ray-x
Once the float window is too big to fit under/ over the current line of insert it overlaps it. (change font size to check)
messing with the option you mentioned mess up everything (even if the window fit it overlaps the line, because its randomly render above or under the line), floating_window_above_cur_line = true - even this options cant force float window to render above line
floating_window_off_y = -1

floating_window_off_y = 1

would be great if the float window would get dynamic sizing, just a % of window width and height
my config:
require "lsp_signature".setup({
floating_window = true,
floating_window_off_y = 0,
bind = true,
floating_window_above_cur_line = true,
doc_lines = 10,
hint_enable = false,
handler_opts = {
border = "rounded"
},
-- zindex = 1,
-- hint_prefix = " >",
-- max_width = 120,
})
Hi, Could you try latest version
The issue is fixed in https://github.com/ray-x/lsp_signature.nvim/commit/4156acf14b2b4f7d4db3f232228e80932ec5dd5d
The wrap option need to set to true (default false now)
Wow amazing, it seems to be working fine!
I just enabled at my personal pc, tomorrow will enable at work too and will test all day.
@ray-x works great now, i think the window shouldn't be rendered when it overlaps current line, so it would solve the overlap issue, also the offset for y should be secured, like there should be option to chose to render the window only above(it doesnt work) or only below, so the y offset may stay always positive
From my testing it's working just fine now
I just noticed that occasionally the border line goes missing, the float window still show up as expected only without the border line. It happened couple times now.
By chance related to the latest change?
There is another reporting regarding the border missing
https://github.com/ray-x/lsp_signature.nvim/issues/190
Thank you, will follow up there.
BTW it's kinda rare the situations that I need to resize the terminal to a small size but I found the floating window overlapping again. However in most cases it's working fine, it seems to work fine for the normal use.
The floating wont resizes together with the terminal. The nearest solution might be close and reopen the floating window. If you feel the feature is essential to you, you can submit a separate issue.
Hi..
Found it overlaping again in a normal use.
Check this test file in a normal terminal size, with a big signature the floating window overlapped again the current line
https://user-images.githubusercontent.com/29671981/179425996-5f548604-46d6-4177-801c-0efe355ad44a.mp4
You can set wrap=true in setup and check if it fixes the issue.
Actually I tried that, I just reset all config to default except for the wrap which I changed to true
well, pushed another change for this. Could you check if it works?
when i do enter insert mode to make the popup signature show then the bug still show up, it overlaps the current line (border render fine, also text wraps fine), but when i just move out and in, at insert mode (by arrows) it doesn't overlap current line anymore ( border stop rendering), the 2nd kind of window sometimes happen randomly, it was the only one i could reproduce Screencast from 07-18-2022 09:28:48 AM.webm
https://user-images.githubusercontent.com/1681295/179486803-8351592f-18a0-4b47-9d1b-4e5f354608ef.mp4
Should be good now.
Yep, it seems to be working fine
Hi,
Latest fix was working just fine, no issue so far, but I just found one more situation where it still overlaps.
In case the floating window is already up, and I press enter to go to next line, cursor goes behind and the floating window stay still.
I'm on latest version: 4665921
https://user-images.githubusercontent.com/29671981/183228365-e0e127bb-878a-4dd5-babb-875141e5cdb2.mp4