Skip to content
This repository was archived by the owner on Oct 13, 2021. It is now read-only.

Commit 7ee7351

Browse files
committed
fix again: overwrite small amount of signature help callbacks(#199)
1 parent e451249 commit 7ee7351

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

lua/completion/signature_help.lua

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,22 @@ M.autoOpenSignatureHelp = function()
2727
end
2828

2929
if triggered then
30-
vim.lsp.buf.signature_help()
30+
-- overwrite signature help here to disable "no signature help" message
31+
local params = vim.lsp.util.make_position_params()
32+
vim.lsp.buf_request(0, 'textDocument/signatureHelp', params, function(_, method, result)
33+
if not (result and result.signatures and result.signatures[1]) then
34+
return
35+
end
36+
local lines = vim.lsp.util.convert_signature_help_to_markdown_lines(result)
37+
if vim.tbl_isempty(lines) then
38+
return
39+
end
40+
vim.lsp.util.focusable_preview(method, function()
41+
-- TODO show popup when signatures is empty?
42+
lines = vim.lsp.util.trim_empty_lines(lines)
43+
return lines, vim.lsp.util.try_trim_markdown_code_blocks(lines)
44+
end)
45+
end)
3146
end
3247
end
3348

0 commit comments

Comments
 (0)