@@ -525,11 +525,16 @@ end
525525
526526-- note: this is a neovim internal function from lsp/util.lua
527527
528+ --- @private
529+ --- Computes size of float needed to show contents (with optional wrapping)
530+ ---
528531--- @param contents string[] of lines to show in window
529532--- @param opts ? vim.lsp.util.open_floating_preview.Opts
530533--- @return integer width size of float
531534--- @return integer height size of float
532535local function make_floating_popup_size (contents , opts )
536+ validate (' contents' , contents , ' table' )
537+ validate (' opts' , opts , ' table' , true )
533538 opts = opts or {}
534539
535540 local width = opts .width
@@ -614,14 +619,14 @@ helper.cal_pos = function(contents, opts)
614619 -- and return language_id
615620 -- 2. in other cases, no lines will be removed, and return "markdown"
616621 local filetype = helper .try_trim_markdown_code_blocks (contents )
617- log (vim .inspect (contents ), opts )
618622
619623 local width , height = make_floating_popup_size (contents , opts )
624+ log (' popup size:' , width , height , opts )
620625 -- if the filetype returned is "markdown", and contents contains code fences, the height should minus 2, note,
621626 -- for latests nvim with conceal level 2 there is no need to `-2`
622627 -- because the code fences won't be display
623628 local code_block_flag = contents [1 ]:match (' ^```' )
624- if filetype == ' markdown' and code_block_flag ~= nil and vim . fn . has ( ' nvim-0.11 ' ) == 0 then
629+ if filetype == ' markdown' and code_block_flag ~= nil then
625630 height = height - 2
626631 end
627632 local float_option = util .make_floating_popup_options (width , height , opts )
0 commit comments