]> Sergey Matveev's repositories - vim-lsp.git/commitdiff
Make it possible to provide a title for the peek popup
authorAndreas Louv <andreas@louv.dk>
Tue, 21 Mar 2023 20:36:51 +0000 (21:36 +0100)
committerAndreas Louv <andreas@louv.dk>
Tue, 21 Mar 2023 21:16:50 +0000 (22:16 +0100)
autoload/lsp/lspserver.vim
autoload/lsp/symbol.vim

index 48c316309b3b320590d2bd8fee41cb45b3116789..e3cb85ad23a6a959dcb563fba23d4abd339db031 100644 (file)
@@ -1064,7 +1064,7 @@ def ShowReferences(lspserver: dict<any>, peek: bool): void
     return
   endif
 
-  symbol.ShowLocations(lspserver, reply.result, peek)
+  symbol.ShowLocations(lspserver, reply.result, peek, 'Symbol References')
 enddef
 
 # process the 'textDocument/documentHighlight' reply from the LSP server
index 964d117de9675e47230dc1db2066838f867d9e73..74fed32a58e2fab0edc1b2aa610452960921fd1b 100644 (file)
@@ -303,7 +303,8 @@ enddef
 
 # Display the locations in a popup menu.  Display the corresponding file in
 # an another popup window.
-def PeekLocations(lspserver: dict<any>, locations: list<dict<any>>)
+def PeekLocations(lspserver: dict<any>, locations: list<dict<any>>,
+                  title: string)
   if lspserver.peekSymbolPopup->winbufnr() != -1
     # If the symbol popup window is already present, close it.
     lspserver.peekSymbolPopup->popup_close()
@@ -330,7 +331,7 @@ def PeekLocations(lspserver: dict<any>, locations: list<dict<any>>)
   endfor
 
   var popupAttrs = {
-    title: 'References',
+    title: title,
     wrap: false,
     pos: 'topleft',
     line: 'cursor+1',
@@ -348,10 +349,10 @@ def PeekLocations(lspserver: dict<any>, locations: list<dict<any>>)
   UpdatePeekFilePopup(lspserver, locations)
 enddef
 
-# Display or peek locations in a loclist
-export def ShowLocations(lspserver: dict<any>, locations: list<dict<any>>, peekSymbol: bool)
+export def ShowLocations(lspserver: dict<any>, locations: list<dict<any>>,
+                         peekSymbol: bool, title: string)
   if peekSymbol
-    PeekLocations(lspserver, locations)
+    PeekLocations(lspserver, locations, title)
     return
   endif
 
@@ -375,7 +376,7 @@ export def ShowLocations(lspserver: dict<any>, locations: list<dict<any>>, peekS
   endfor
 
   var save_winid = win_getid()
-  setloclist(0, [], ' ', {title: 'Symbol Reference', items: qflist})
+  setloclist(0, [], ' ', {title: title, items: qflist})
   var mods: string = ''
   exe $'{mods} lopen'
   if !opt.lspOptions.keepFocusInReferences