aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/handlers.lua
diff options
context:
space:
mode:
authorMichael Lingelbach <m.j.lbach@gmail.com>2021-03-23 09:38:21 -0700
committerGitHub <noreply@github.com>2021-03-23 09:38:21 -0700
commit9f5c8226bba43b6c9ae253e6b94b41d9d140a626 (patch)
tree944f68dc6fd22e4b3e1a179227429fa9834e0569 /runtime/lua/vim/lsp/handlers.lua
parented200898773295e55dd29b57bd6a4b1ada56e03e (diff)
parent3113d4befa42eade1b1cf9698189f4082e2d6c29 (diff)
downloadrneovim-9f5c8226bba43b6c9ae253e6b94b41d9d140a626.tar.gz
rneovim-9f5c8226bba43b6c9ae253e6b94b41d9d140a626.tar.bz2
rneovim-9f5c8226bba43b6c9ae253e6b94b41d9d140a626.zip
Merge pull request #14186 from mjlbach/feature/make_signature_help_beautiful
lsp: add syntax highlighting to signature help
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 0cf80e1443..eacbd90077 100644
--- a/runtime/lua/vim/lsp/handlers.lua
+++ b/runtime/lua/vim/lsp/handlers.lua
@@ -304,7 +304,7 @@ M['textDocument/typeDefinition'] = location_handler
M['textDocument/implementation'] = location_handler
--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_signatureHelp
-M['textDocument/signatureHelp'] = function(_, method, result)
+M['textDocument/signatureHelp'] = function(_, method, result, _, bufnr)
-- When use `autocmd CompleteDone <silent><buffer> lua vim.lsp.buf.signature_help()` to call signatureHelp handler
-- If the completion item doesn't have signatures It will make noise. Change to use `print` that can use `<silent>` to ignore
if not (result and result.signatures and result.signatures[1]) then
@@ -317,9 +317,11 @@ M['textDocument/signatureHelp'] = function(_, method, result)
print('No signature help available')
return
end
- util.focusable_preview(method, function()
+ local syntax = api.nvim_buf_get_option(bufnr, 'syntax')
+ local p_bufnr, _ = util.focusable_preview(method, function()
return lines, util.try_trim_markdown_code_blocks(lines)
end)
+ api.nvim_buf_set_option(p_bufnr, 'syntax', syntax)
end
--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_documentHighlight