autoload/handlers.vim | 25 ++++++++++++++++++++----- doc/lsp.txt | 4 +++- plugin/lsp.vim | 4 ++++ diff --git a/autoload/handlers.vim b/autoload/handlers.vim index 6db5dbd48e28ed73cd23e10ad54e58167853b2d5..e895a79b9c2224bf90f4b66ad8dafa22e3f3eb0c 100644 --- a/autoload/handlers.vim +++ b/autoload/handlers.vim @@ -120,15 +120,30 @@ var startcol = 0 if sig->has_key('parameters') && result->has_key('activeParameter') var params_len = sig.parameters->len() if params_len > 0 && result.activeParameter < params_len - var label = sig.parameters[result.activeParameter].label + var label = '' + if sig.parameters[result.activeParameter]->has_key('documentation') + label = sig.parameters[result.activeParameter].documentation + else + label = sig.parameters[result.activeParameter].label + endif hllen = label->len() startcol = text->stridx(label) endif endif - var popupID = text->popup_atcursor({moved: 'any'}) - prop_type_add('signature', {bufnr: popupID->winbufnr(), highlight: 'LineNr'}) - if hllen > 0 - prop_add(1, startcol + 1, {bufnr: popupID->winbufnr(), length: hllen, type: 'signature'}) + if g:LSP_Echo_Signature + echon "\r\r" + echon '' + echon strpart(text, 0, startcol) + echoh LineNr + echon strpart(text, startcol, hllen) + echoh None + echon strpart(text, startcol + hllen) + else + var popupID = text->popup_atcursor({moved: 'any'}) + prop_type_add('signature', {bufnr: popupID->winbufnr(), highlight: 'LineNr'}) + if hllen > 0 + prop_add(1, startcol + 1, {bufnr: popupID->winbufnr(), length: hllen, type: 'signature'}) + endif endif enddef diff --git a/doc/lsp.txt b/doc/lsp.txt index 674bf2bfc2cbf439f60f4349e4772a3fbd7c2de0..788b2a08fb31270180602229e4578ead74a86f0c 100644 --- a/doc/lsp.txt +++ b/doc/lsp.txt @@ -215,7 +215,9 @@ The popup is also automatically displayed in insert mode after entering a symbol name followed by a separator (e.g. a opening parenthesis). Unless if: > - let g:LSP_Show_Signature = v:false + let g:LSP_Show_Signature = v:false. If you set + g:LSP_Show_Signature = 1 the signature will be echoed + in cmdline rather displayed in a popup. < Default is true. diff --git a/plugin/lsp.vim b/plugin/lsp.vim index 572e201cb922d2f7f5c26e22ab6de2d092fff530..512b57be9a9b19dd2977632bdd581ce40c6c13d4 100644 --- a/plugin/lsp.vim +++ b/plugin/lsp.vim @@ -15,6 +15,10 @@ if !exists('g:LSP_Show_Signature') let g:LSP_Show_Signature = v:true endif +if !exists('g:LSP_Echo_Signature') + let g:LSP_Echo_Signature = v:false +endif + augroup LSPAutoCmds au! autocmd BufNewFile,BufReadPost *