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

Commit 92f26db

Browse files
authored
Merge pull request #201 from Xuyuanp/custom_signature_help_callback
Used default signature help callback firstly if exists
2 parents bef8858 + 1694e62 commit 92f26db

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lua/completion/signature_help.lua

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ local M = {}
88
-- signature help --
99
----------------------
1010
M.autoOpenSignatureHelp = function()
11-
local bufnr = api.nvim_get_current_buf()
1211
local pos = api.nvim_win_get_cursor(0)
1312
local line = api.nvim_get_current_line()
1413
local line_to_cursor = line:sub(1, pos[2])
@@ -29,7 +28,13 @@ M.autoOpenSignatureHelp = function()
2928
if triggered then
3029
-- overwrite signature help here to disable "no signature help" message
3130
local params = vim.lsp.util.make_position_params()
32-
vim.lsp.buf_request(0, 'textDocument/signatureHelp', params, function(_, method, result)
31+
vim.lsp.buf_request(0, 'textDocument/signatureHelp', params, function(err, method, result, client_id)
32+
local client = vim.lsp.get_client_by_id(client_id)
33+
local callback = client and client.callbacks['textDocument/signatureHelp']
34+
if callback then
35+
callback(err, method, result, client_id)
36+
return
37+
end
3338
if not (result and result.signatures and result.signatures[1]) then
3439
return
3540
end

0 commit comments

Comments
 (0)