Open beavailable opened 6 months ago
For anyone who face the same problem, I have a solution for delimitMate
(thanks to @girishji ):
showSignature: false
vimrc
:
au BufEnter * inoremap <silent> <buffer> ( (<Plug>delimitMate(<C-R>=g:LspShowSignature()<CR><BS>
As you can guess, I've used delimitMate
back instead of lexima
, because of https://github.com/cohama/lexima.vim/issues/36
Append: Here might be a more general solution:
au BufEnter * inoremap <silent> <buffer> ( ()<Left><C-R>=g:LspShowSignature()<CR>
It works for delimitMate
too, but I haven't tried it with lexima
.
Update: The autocmd above doesn't work perfectly, if you use this solution, you can't get current (after the first) parameter highlighted.
Here's the latest solution which doesn't require showSignature: false
and works well enough:
au InsertEnter <buffer> ++once inoremap <silent> <buffer> ( ()<Left><C-R>=g:LspShowSignature()<CR>
The reason I use InsertEnter
event is that this mapping should override the one from lsp
plugin which is executed when BufNewFile,BufReadPost
are triggered, so the event I use should be triggered later than that. Also, if I use BufNewFile,BufReadPost
in my vimrc it won't work, because the mapping is always executed before the one from lsp
plugin.
If you use lsp
plugin only for certain filetypes (like me), you can write like this:
au FileType java,python {
au InsertEnter ...
}
Again, I'm not using lexima
, so I'm not sure if it works with lexima
.
Normally with lexima, in a
python
file, I have:And when I type
(
I'll get:Unfortunately, after installing this
lsp
plugin, I can't get auto-closed parentheses anymore. I'm not sure what was wrong, but if I remove this plugin,lexima
could work correctly.