feat(lsp): improve signature help display #35190

- Add delimiter between function signature and documentation, matching hover formatting
- Show title only if there are multiple clients or multiple signatures
- Avoid duplicating the title inside the window if it's already shown in the border
This commit is contained in:
skewb1k
2025-08-07 05:56:02 +03:00
committed by GitHub
parent d73f2d9657
commit d26db4bfbf
3 changed files with 18 additions and 10 deletions

View File

@@ -404,15 +404,19 @@ function M.signature_help(config)
return
end
local sfx = total > 1
and string.format(' (%d/%d)%s', idx, total, can_cycle and ' (<C-s> to cycle)' or '')
or ''
config.title = config.title or string.format('Signature Help: %s%s', client.name, sfx)
if not config.border then
table.insert(lines, 1, '# ' .. config.title)
if hl then
hl[1] = hl[1] + 1
hl[3] = hl[3] + 1
-- Show title only if there are multiple clients or multiple signatures.
if total > 1 then
local sfx = total > 1
and string.format(' (%d/%d)%s', idx, total, can_cycle and ' (<C-s> to cycle)' or '')
or ''
config.title = config.title or string.format('Signature Help: %s%s', client.name, sfx)
-- If no border is set, render title inside the window.
if not (config.border or vim.o.winborder ~= '') then
table.insert(lines, 1, '# ' .. config.title)
if hl then
hl[1] = hl[1] + 1
hl[3] = hl[3] + 1
end
end
end