Signature help mapping conflicts with other mappings to ( or {
I use this old vim-PairTools plugin for per-filetype automatic pair insertion.
For some reason the plugin breaks pair insertion for ( and { characters. Any idea why?
Seems like it is the LspShowSignature mapping. Would be nice to have both actually. Maybe a more advanced trigger than ( would be needed.
Found a workaround. You can turn off the signatureHelp option and then use
autocmd InsertCharPre * call g:LspShowSignature()
It's a bit excessive to call this every time a character is inserted. Would be nice if there were an InsertCharPost!
I asked the coc.nvim developers how they handle it. Seems they check if the last inserted character matches the trigger char and then do an InsertCharPre.
This seems to work as expected
function! s:MaybeShowSignature(timer)
if g:last_char_was_trigger
let g:last_char_was_trigger = 0
call g:LspShowSignature()
endif
endfunction
let g:last_char_was_trigger = 0
autocmd InsertCharPre * if v:char ==# '(' | let g:last_char_was_trigger = 1 | call timer_start(10, function('s:MaybeShowSignature')) | endif
autocmd InsertCharPre * if v:char ==# '{' | let g:last_char_was_trigger = 1 | call timer_start(10, function('s:MaybeShowSignature')) | endif