diff options
author | Folke Lemaitre <folke.lemaitre@gmail.com> | 2021-07-08 08:04:35 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-07 23:04:35 -0700 |
commit | af263711a368bcbdea66d086537316495ed64576 (patch) | |
tree | 703791a731f5a7dfbff61e0a75d7931ea7f1a1ea /runtime/lua/vim/lsp/handlers.lua | |
parent | f2205b83c553367a76b6cad04a673077ae150fc1 (diff) | |
download | rneovim-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.lua | 9 |
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 |