aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp/callbacks.lua
diff options
context:
space:
mode:
authorRaphael <glepnir@gopherhub.org>2020-09-18 21:37:53 +0800
committerGitHub <noreply@github.com>2020-09-18 09:37:53 -0400
commit569e75799d7015b15631c80cee1feec561f29df7 (patch)
tree55efb5667b89c882584a5a8696fbdb06ed6364f7 /runtime/lua/vim/lsp/callbacks.lua
parent6dc815530b7b127c5b5e0912783c3f2118cb184f (diff)
downloadrneovim-569e75799d7015b15631c80cee1feec561f29df7.tar.gz
rneovim-569e75799d7015b15631c80cee1feec561f29df7.tar.bz2
rneovim-569e75799d7015b15631c80cee1feec561f29df7.zip
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
Diffstat (limited to 'runtime/lua/vim/lsp/callbacks.lua')
-rw-r--r--runtime/lua/vim/lsp/callbacks.lua21
1 files changed, 12 insertions, 9 deletions
diff --git a/runtime/lua/vim/lsp/callbacks.lua b/runtime/lua/vim/lsp/callbacks.lua
index 0ee03e6a2f..4e7a8333a0 100644
--- a/runtime/lua/vim/lsp/callbacks.lua
+++ b/runtime/lua/vim/lsp/callbacks.lua
@@ -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