aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/util.lua
diff options
context:
space:
mode:
authorFolke Lemaitre <folke.lemaitre@gmail.com>2021-05-21 19:19:17 +0200
committerFolke Lemaitre <folke.lemaitre@gmail.com>2021-05-21 19:55:30 +0200
commitbfdd750fce97e50029cf6503f791556ffeb2c08e (patch)
tree138377314e0907c0e59fcafad212ceacb188b8cd /runtime/lua/vim/lsp/util.lua
parent02390af5a672d1ec9f0d72db8fb7519a43f23bae (diff)
downloadrneovim-bfdd750fce97e50029cf6503f791556ffeb2c08e.tar.gz
rneovim-bfdd750fce97e50029cf6503f791556ffeb2c08e.tar.bz2
rneovim-bfdd750fce97e50029cf6503f791556ffeb2c08e.zip
feat(lsp): use fancy_floating_markdown for signature_help
Diffstat (limited to 'runtime/lua/vim/lsp/util.lua')
-rw-r--r--runtime/lua/vim/lsp/util.lua10
1 files changed, 8 insertions, 2 deletions
diff --git a/runtime/lua/vim/lsp/util.lua b/runtime/lua/vim/lsp/util.lua
index 0434c247b8..2ae9be57c0 100644
--- a/runtime/lua/vim/lsp/util.lua
+++ b/runtime/lua/vim/lsp/util.lua
@@ -804,9 +804,10 @@ end
--- Converts `textDocument/SignatureHelp` response to markdown lines.
---
--@param signature_help Response of `textDocument/SignatureHelp`
+--@param ft optional filetype that will be use as the `lang` for the label markdown code block
--@returns list of lines of converted markdown.
--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_signatureHelp
-function M.convert_signature_help_to_markdown_lines(signature_help)
+function M.convert_signature_help_to_markdown_lines(signature_help, ft)
if not signature_help.signatures then
return
end
@@ -824,7 +825,12 @@ function M.convert_signature_help_to_markdown_lines(signature_help)
if not signature then
return
end
- vim.list_extend(contents, vim.split(signature.label, '\n', true))
+ local label = signature.label
+ if ft then
+ -- wrap inside a code block so fancy_markdown can render it properly
+ label = ("```%s\n%s\n```"):format(ft, label)
+ end
+ vim.list_extend(contents, vim.split(label, '\n', true))
if signature.documentation then
M.convert_input_to_markdown_lines(signature.documentation, contents)
end