]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Add : Possibility to echo signature in cmdline
authorIndelog <maxime@indelog.fr>
Mon, 8 Nov 2021 13:05:09 +0000 (14:05 +0100)
committerIndelog <maxime@indelog.fr>
Thu, 11 Nov 2021 14:05:02 +0000 (15:05 +0100)
autoload/handlers.vim
doc/lsp.txt
plugin/lsp.vim

index 6db5dbd48e28ed73cd23e10ad54e58167853b2d5..e895a79b9c2224bf90f4b66ad8dafa22e3f3eb0c 100644 (file)
@@ -120,15 +120,30 @@ def s:processSignaturehelpReply(lspserver: dict<any>, req: dict<any>, reply: dic
   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
 
index 674bf2bfc2cbf439f60f4349e4772a3fbd7c2de0..788b2a08fb31270180602229e4578ead74a86f0c 100644 (file)
@@ -215,7 +215,9 @@ accepts a list of LSP servers with the above information.
                        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.
 
index 572e201cb922d2f7f5c26e22ab6de2d092fff530..512b57be9a9b19dd2977632bdd581ce40c6c13d4 100644 (file)
@@ -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 *