mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 18:55:14 -07:00
lsp: remove popup No signature available. (#12915)
* lsp: remove popup No signature available. If no signatures. we shouldn't popup No signature available ..It will make noise when use ` api.nvim_command("autocmd CompleteDone <buffer> lua vim.lsp.buf.signature_help()")` * fix ci test failed remove whitespace * print message when no signature help * Add comment
This commit is contained in:
parent
6dc815530b
commit
569e75799d
@ -229,16 +229,19 @@ M['textDocument/implementation'] = location_callback
|
||||
|
||||
--@see https://microsoft.github.io/language-server-protocol/specifications/specification-current/#textDocument_signatureHelp
|
||||
M['textDocument/signatureHelp'] = function(_, method, result)
|
||||
-- When use `autocmd CompleteDone <silent><buffer> lua vim.lsp.buf.signature_help()` to call signatureHelp callback
|
||||
-- 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
|
||||
print('No signature help available')
|
||||
return
|
||||
end
|
||||
local lines = util.convert_signature_help_to_markdown_lines(result)
|
||||
lines = util.trim_empty_lines(lines)
|
||||
if vim.tbl_isempty(lines) then
|
||||
print('No signature help available')
|
||||
return
|
||||
end
|
||||
util.focusable_preview(method, function()
|
||||
if not (result and result.signatures and result.signatures[1]) then
|
||||
return { 'No signature available' }
|
||||
end
|
||||
-- TODO show popup when signatures is empty?
|
||||
local lines = util.convert_signature_help_to_markdown_lines(result)
|
||||
lines = util.trim_empty_lines(lines)
|
||||
if vim.tbl_isempty(lines) then
|
||||
return { 'No signature available' }
|
||||
end
|
||||
return lines, util.try_trim_markdown_code_blocks(lines)
|
||||
end)
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user