aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/handlers.lua
diff options
context:
space:
mode:
authorFolke Lemaitre <folke.lemaitre@gmail.com>2021-07-08 08:04:35 +0200
committerGitHub <noreply@github.com>2021-07-07 23:04:35 -0700
commitaf263711a368bcbdea66d086537316495ed64576 (patch)
tree703791a731f5a7dfbff61e0a75d7931ea7f1a1ea /runtime/lua/vim/lsp/handlers.lua
parentf2205b83c553367a76b6cad04a673077ae150fc1 (diff)
downloadrneovim-af263711a368bcbdea66d086537316495ed64576.tar.gz
rneovim-af263711a368bcbdea66d086537316495ed64576.tar.bz2
rneovim-af263711a368bcbdea66d086537316495ed64576.zip
feat(lsp): highlight active parameter in signature help (#15018)
Diffstat (limited to 'runtime/lua/vim/lsp/handlers.lua')
-rw-r--r--runtime/lua/vim/lsp/handlers.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/runtime/lua/vim/lsp/handlers.lua b/runtime/lua/vim/lsp/handlers.lua
index 41852b9d88..7da24d8c43 100644
--- a/runtime/lua/vim/lsp/handlers.lua
+++ b/runtime/lua/vim/lsp/handlers.lua
@@ -316,6 +316,7 @@ M['textDocument/typeDefinition'] = location_handler
M['textDocument/implementation'] = location_handler
--- |lsp-handler| for the method "textDocument/signatureHelp"
+--- The active parameter is highlighted with |hl-LspSignatureActiveParameter|
--- <pre>
--- vim.lsp.handlers["textDocument/signatureHelp"] = vim.lsp.with(
--- vim.lsp.handlers.signature_help, {
@@ -338,13 +339,17 @@ function M.signature_help(_, method, result, _, bufnr, config)
return
end
local ft = api.nvim_buf_get_option(bufnr, 'filetype')
- local lines = util.convert_signature_help_to_markdown_lines(result, ft)
+ local lines, hl = util.convert_signature_help_to_markdown_lines(result, ft)
lines = util.trim_empty_lines(lines)
if vim.tbl_isempty(lines) then
print('No signature help available')
return
end
- return util.open_floating_preview(lines, "markdown", config)
+ local fbuf, fwin = util.open_floating_preview(lines, "markdown", config)
+ if hl then
+ api.nvim_buf_add_highlight(fbuf, -1, "LspSignatureActiveParameter", 0, unpack(hl))
+ end
+ return fbuf, fwin
end
--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_signatureHelp