Open ray-x opened 2 years ago
If anybody looks at this code, the correct code is:
local function escape_term_codes(str)
return vim.api.nvim_replace_termcodes(str, true, false, true)
end
local function is_float_open(window_id)
return window_id and window_id ~= 0 and vim.api.nvim_win_is_valid(window_id)
end
local function scroll_float(mapping)
local win_id = _G._LSP_SIG_CFG.winnr;
if is_float_open(win_id) then
vim.fn.win_execute(win_id, ':normal! ' .. mapping)
end
end
local scroll_up_mapping = escape_term_codes('<c-u>')
local scroll_down_mapping = escape_term_codes('<c-d>')
vim.keymap.set('i', '<c-u>', function() scroll_float(scroll_up_mapping) end, {})
vim.keymap.set('i', '<c-d>', function() scroll_float(scroll_down_mapping) end, {})
there were different names in is_lsp_float_open and is_float_open.
I really think this should be a feature that is there out of the box. Many times documentations cannot be seen because it is cut off. For example, this happens to almost all the nvim lua documentations:
It is not hard to implement this feature. In fact, I have done something similar already:
Also, there is no scrollbar in the signature help, which I think is crucial to have, in order to even know that there is any documentation below the currently visible area. Otherwise, one would not even notice that. Something similar to the pum scrollbar would be nice. Many plugins do such a thing, for example
nvim-cmp
shows the scrollbar both in the completion and documentation window: One can scroll through the documentation window by using thenvim-cmp
config:So please add this feature, it would be great! :)
_Originally posted by @DasOhmoff in https://github.com/ray-x/lsp_signature.nvim/issues/110#issuecomment-1295831482_