aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/handlers.lua
diff options
context:
space:
mode:
authorMaria José Solano <majosolano99@gmail.com>2023-10-16 08:52:48 -0700
committerGitHub <noreply@github.com>2023-10-16 08:52:48 -0700
commit2eecb1b85dbb0e02ec40e95d28d3cc4720040f01 (patch)
tree508a54dd5c32345fa640cdaada4c8e5b4a8902a0 /runtime/lua/vim/lsp/handlers.lua
parentc46a6c065e8d830adb8a2f410d3c92cf5bd4455b (diff)
downloadrneovim-2eecb1b85dbb0e02ec40e95d28d3cc4720040f01.tar.gz
rneovim-2eecb1b85dbb0e02ec40e95d28d3cc4720040f01.tar.bz2
rneovim-2eecb1b85dbb0e02ec40e95d28d3cc4720040f01.zip
fix(lsp): highlight active parameter in signature help #25663
Fixes #25662
Diffstat (limited to 'runtime/lua/vim/lsp/handlers.lua')
-rw-r--r--runtime/lua/vim/lsp/handlers.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua
index d3b199b866..d153b956ee 100644
--- a/runtime/lua/vim/lsp/handlers.lua
+++ b/runtime/lua/vim/lsp/handlers.lua
@@ -476,7 +476,7 @@ function M.signature_help(_, result, ctx, config)
vim.tbl_get(client.server_capabilities, 'signatureHelpProvider', 'triggerCharacters')
local ft = vim.bo[ctx.bufnr].filetype
local lines, hl = util.convert_signature_help_to_markdown_lines(result, ft, triggers)
- if vim.tbl_isempty(lines) then
+ if not lines or vim.tbl_isempty(lines) then
if config.silent ~= true then
print('No signature help available')
end
@@ -484,7 +484,9 @@ function M.signature_help(_, result, ctx, config)
end
local fbuf, fwin = util.open_floating_preview(lines, 'markdown', config)
if hl then
- api.nvim_buf_add_highlight(fbuf, -1, 'LspSignatureActiveParameter', 0, unpack(hl))
+ -- Highlight the second line if the signature is wrapped in a Markdown code block.
+ local line = vim.startswith(lines[1], '```') and 1 or 0
+ api.nvim_buf_add_highlight(fbuf, -1, 'LspSignatureActiveParameter', line, unpack(hl))
end
return fbuf, fwin
end