-
Notifications
You must be signed in to change notification settings - Fork 49
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
feature: resize LSP hover windows based on concealed lines #384
Labels
enhancement
New feature or request
Comments
MeanderingProgrammer
added a commit
that referenced
this issue
Mar 31, 2025
## Details Request: #384 Since the `conceal_lines` directive is enabled in the default highlights neovim actively handles reducing the height of LSP hover doc windows to remove unnecessary vertical space. This happens here: https://github.com/neovim/neovim/blob/master/runtime/lua/vim/lsp/util.lua#L1657-L1661 ```lua -- Reduce window height if TS highlighter conceals code block backticks. local conceal_height = api.nvim_win_text_height(floating_winnr, {}).all if conceal_height < api.nvim_win_get_height(floating_winnr) then api.nvim_win_set_height(floating_winnr, conceal_height) end ``` Since our decorations are added separately from highlights and behave very differently there would be no way for neovim to practically pickup highlights added by this plugin. To get around this we essentially re-implement this same logic as part of this plugin. After the first load of a buffer when we are just about to add our `extmark`s check if the buffer is related to LSP hover docs and if it is adjust the height taking into account the concealed lines that will be added (removed) by this plugin. I don't see this as a bug, since adjusting windows to fit their content is not something this plugin ever intended to do and supporting every feature in neovim is not the goal. However, since this is for a very specific scenario and the implementation is straightforward I've added it. > [!CAUTION] > We'll likely need to update how we identify LSP hover doc buffers over > time since the current approach is tied to internal undocumented behavior. > [!NOTE] > See if we can add a marker on LSP buffers that is a documented feature > others can rely on, if such a thing doesn't already exist.
Added support to resize LSP windows here: 17b839b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Neovim version (nvim -v)
0.11.0
Neovim distribution
N/A
Operating system
Linux
Terminal emulator / GUI
Kitty
Describe the bug
I've noticed that even though the backticks for code blocks are concealed, there is still an additional two lines at the end of hover windows:
Without this plugin:
With this plugin:
Expected behavior
The hover window should not have this extra lines, just like the first capture.
Healthcheck output
Plugin configuration
Plugin error log
Confirmations
Additional information
I can reproduce this behaviour with the following steps:
nvim-linux-x86_64.appimage
is the official appimage build.a.lua
init.lua
:The text was updated successfully, but these errors were encountered: