Skip to content

Commit a793d02

Browse files
committed
bugfix: Redundant blank lines in menu #359
1 parent 5c11ddb commit a793d02

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
Show function signature when you type
44

5-
- This nvim plugin is made for completion plugins that do not support signature help. Need neovim-0.8+ and enable
6-
nvim-lsp. (check neovim-0.5/neovim-0.6/neovim-0.9 branch for earlier version support)
5+
- This nvim plugin is made for completion plugins that do not support signature help. Need neovim-0.10+. (check
6+
neovim-0.5/neovim-0.6/neovim-0.9 branch for earlier version support)
77

88
- Inspired by [completion-nvim](https://github.com/nvim-lua/completion-nvim), which does have lots of cool features.
99

@@ -94,7 +94,6 @@ local golang_setup = {
9494
require'lspconfig'.gopls.setup(golang_setup)
9595
```
9696

97-
9897
If you using Lazy.nvim, you can pass the config in the `opts` table:
9998

10099
```lua
@@ -153,7 +152,8 @@ No default keymaps are provided. Following are keymaps available in config:
153152

154153
1. toggle_key: Toggle the signature help window. It manual toggle config.floating_windows on/off
155154
2. select_signature_key: Select the current signature when multiple signature is available.
156-
3. move floating window: move_cursor_key, array of two keymaps, if set, you can use these keymaps to move floating window up and down, default is nil
155+
3. move floating window: move_cursor_key, array of two keymaps, if set, you can use these keymaps to move floating
156+
window up and down, default is nil
157157

158158
#### Customize the keymap in your config:
159159

@@ -187,7 +187,7 @@ e.g.
187187
-- This setting only take effect in insert mode, it does not affect signature help in normal
188188
-- mode, 10 by default
189189

190-
max_height = 12, -- max height of signature floating_window
190+
max_height = 12, -- max height of signature floating_window, include borders
191191
max_width = function()
192192
return vim.api.nvim_win_get_width(0) * 0.8
193193
end, -- max_width of signature floating_window, line will be wrapped if exceed max_width

lua/lsp_signature/helper.lua

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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
532535
local 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

Comments
 (0)