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

Commit cce61c4

Browse files
committed
feat: open signature help with respect to lsp triggered characters
1 parent 9c12e8e commit cce61c4

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

lua/completion/signature_help.lua

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
local vim = vim
22
local validate = vim.validate
33
local api = vim.api
4+
local util = require 'completion.util'
45
local M = {}
56

67
----------------------
@@ -128,7 +129,10 @@ M.autoOpenSignatureHelp = function(bufnr, line_to_cursor)
128129
local pos = api.nvim_win_get_cursor(0)
129130
local line = api.nvim_get_current_line()
130131
local line_to_cursor = line:sub(1, pos[2])
131-
if string.sub(line_to_cursor, #line_to_cursor, #line_to_cursor) == '(' then
132+
if vim.lsp.buf_get_clients()[1].server_capabilities.signatureHelpProvider == nil then return end
133+
local triggered = util.checkTriggerCharacter(line_to_cursor,
134+
vim.lsp.buf_get_clients()[1].server_capabilities.signatureHelpProvider.triggerCharacters)
135+
if triggered then
132136
local params = vim.lsp.util.make_position_params()
133137
vim.lsp.buf_request(bufnr, 'textDocument/signatureHelp', params, function(_, method, result)
134138
if not (result and result.signatures and result.signatures[1]) then

0 commit comments

Comments
 (0)