fix_lsp_window shrinks LSP hover float: nvim_win_text_height already accounts for conceal_lines
Maintainer thường phản hồi trong vòng 21 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 78/100
Hướng nghiên cứu
Bắt đầu với lua/render-markdown/lib/compat.lua và xem xét M.fix_lsp_window, đặc biệt là cách hàm này sử dụng nvim_win_text_height() và các extmark conceal_lines. Kiểm tra thời điểm render và cách hoạt động của chiều cao cửa sổ được mô tả trong báo cáo; cách tái hiện được đề xuất dùng Neovim với sqls hover trên một bảng rộng. Hoàn thành khi cửa sổ nổi hover hiển thị toàn bộ bảng đã render ở chiều cao đo được mà không bị thu nhỏ quá mức.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
LSP hover floats get shrunk to a few lines when the hover document contains a rendered markdown table, because compat.fix_lsp_window() subtracts one line per conceal_lines extmark from nvim_win_text_height(), which already returns the post-fold height.
With sqls hovering a 14-column table (18-line hover doc) the float ends up 112x3 instead of 112x19; the rendered table is unreadable (only the first rows visible) even though it was rendered correctly.
:RenderMarkdown disable gives the normal 112x18 float, so this is the plugin, not lspconfig/sqls.
To reproduce
Environment: NVIM v0.13.0-dev-2042+g74f3ce7970, render-markdown 8e87953 (2026-10-10), default opts (file_types = { 'markdown', 'codecompanion' }).
- sqlite db with e.g.
CREATE TABLE big(a INT, b TEXT, c REAL, d BLOB, e INT, f TEXT, g INT, h TEXT, i INT, j TEXT, k INT, l TEXT, m INT, n TEXT); sqlsconnected, cursor on the table name,:lua vim.lsp.buf.hover()
The hover doc is:
# `big` table
| Name | Type | Primary key … | … |
| :--------------- | :--------------- | :---------------------- | … |
| `a` | `INT` | `NO` | `-` | |
…
Actual
win 112x3 nvim_win_text_height = 18 at the time fix_lsp_window runs, 19 after the render settles
extmarks: 15 with conceal_lines, 17 rows of virt_lines (the drawn table)
height = 18 - 15 = 3
Expected
Float large enough for the rendered content (112x19).
Root cause
lua/render-markdown/lib/compat.lua:
-- account for conceal lines marks allowing us to reduce window height
local height = vim.api.nvim_win_text_height(win, {}).all
for _, extmark in ipairs(extmarks) do
if extmark:get().opts.conceal_lines then
height = height - 1
end
end
if height < vim.api.nvim_win_get_height(win) then
vim.api.nvim_win_set_height(win, height)
end
Verified on this Neovim build that nvim_win_text_height() already excludes lines collapsed by conceal_lines marks: for the same 18-line hover doc, a normal (non-float) markdown buffer after render shows the table on rows 3..20 (18 rows, checked with a pty + screenstring()), while nvim_win_text_height() reports 19 (18 rows + the trailing empty line). So the subtraction is a second deduction and the more conceal_lines marks a table produces, the smaller the float gets.
Note also that the function only ever shrinks (if height < ...), so nothing restores the height when the measurement is too small.
Suggested fix
Trust the measurement, and re-measure after the marks have settled:
function M.fix_lsp_window(buf, win, extmarks)
local has_lsp = pcall(vim.api.nvim_win_get_var, win, 'lsp_floating_bufnr')
if not has_lsp then
return
end
local env = require('render-markdown.lib.env')
local str = require('render-markdown.lib.str')
-- width handling unchanged
local width = 0
for _, line in ipairs(vim.api.nvim_buf_get_lines(buf, 0, -1, false)) do
width = math.max(width, str.width(line))
end
if width <= vim.api.nvim_win_get_width(win) then
env.win.set(win, 'wrap', false)
end
vim.schedule(function()
if not vim.api.nvim_win_is_valid(win) then
return
end
local height = vim.api.nvim_win_text_height(win, {}).all
if height ~= vim.api.nvim_win_get_height(win) then
pcall(vim.api.nvim_win_set_height, win, height)
end
end)
end
With this patch the same hover shows 112x19 with the whole table visible. Small terminals stay fine: nvim_win_set_height is clamped by Neovim to the available rows (16-line terminal -> height 14, scrolling inside the float still works).
Checklist
- I have read the CONTRIBUTING guide
- I have searched existing issues
- Ngôn ngữ chính
- Lua
- Star
- 5.2k
- Fork
- 155
- Merge trung bình
- 5 ngày 10 giờ
- Pull request đã merge (30 ngày)
- 1
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của MeanderingProgrammer/render-markdown.nvim
-
bug: grid border errors when pipe_table.wrap = falseCó thể đã có người làm @StudentWeis đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
MeanderingProgrammer/render-markdown.nvim#721 ·
Maintainer thường phản hồi trong vòng 21 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 38/100
MeanderingProgrammer/render-markdown.nvim#711 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 21 ngày
-
bug
Độ khó 4/5 1-2 ngày Mức phù hợp với người mới 55/100
MeanderingProgrammer/render-markdown.nvim#706 ·
Maintainer thường phản hồi trong vòng 21 ngày
-
enhancement
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 38/100
MeanderingProgrammer/render-markdown.nvim#685 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 21 ngày
-
bug: Tables don't render correctly if the pipe at the end of line is missingCó thể đã có người làm @samholmes đã nhận 122 ngày trước. Đang mởbug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 55/100
MeanderingProgrammer/render-markdown.nvim#673 · 2 bình luận ·
Maintainer thường phản hồi trong vòng 21 ngày
Tất cả issue của MeanderingProgrammer/render-markdown.nvim
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
rohit746/pdf-view.nvim#109 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug guide
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement forever
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 61/100
openmap-world/openmap#78 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
AndyHazz/bookends.koplugin#130 ·
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
carlos-algms/agentic.nvim#336 ·