-
Notifications
You must be signed in to change notification settings - Fork 52
feature: allow to customize hover height #396
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
Comments
…r the first time ## Details Request: #396 Adds `on.initial` function which is called only once for a buffer before marks are added on the first render cycle. Context is provided with the buffer and window id. Modify other callbacks called within the main UI loop to also take a window id, meaning `on.render` & `on.clear` are both provided with `win`, since it is a context table this breaks no existing usage. This can be used to make changes to LSP hover docs based on the users knowledge of how their plugins work but identifying buffers as LSP hover docs and applying changes is left up to the user.
Added some support for this here: 91d40c2 Is under a new You can use it to increase the height of a buffer by one using: require('render-markdown').setup({
on = {
initial = function(ctx)
local height = vim.api.nvim_win_text_height(ctx.win, {}).all
vim.api.nvim_win_set_height(ctx.win, height + 1)
end,
},
}) Of course this would apply to all buffers, so you'll need some way to gate it to LSP hover docs specifically. I don't provide a way of doing this since the way this plugin does this relies on undocumented behavior and I don't want others relying on it directly or being surprised if / when it breaks. Welcome to look through this plugin's source code for that if you like, but that's up to you. |
Much appreciated, thanks ! |
Is your feature request related to a problem? Please describe.
First of all, thanks for the awesome plugin!
The addition of LSP hover resizing in 17b839b has introduced an off-by-1 error in the size of hovercraft.nvim, producing rather frustrating hovers on small LSP outputs:
This seems to be due to the "tab" line in hovercraft making the actual rendered text take one extra line.
For comparison, here's the same output before the commit:
Describe the solution you'd like
Ideally, allow for a callback to either modify that height or just execute arbitrary lua code given the number of rendered lines, e.g.:
Describe alternatives you've considered
Additional information
I'd be willing to contribute a PR :)
The text was updated successfully, but these errors were encountered: