From 447a075e9457724f906aada92d831ba6171fb462 Mon Sep 17 00:00:00 2001 From: Andreas Louv Date: Tue, 21 Mar 2023 21:36:51 +0100 Subject: [PATCH] Make it possible to provide a title for the peek popup --- autoload/lsp/lspserver.vim | 2 +- autoload/lsp/symbol.vim | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/autoload/lsp/lspserver.vim b/autoload/lsp/lspserver.vim index 48c3163..e3cb85a 100644 --- a/autoload/lsp/lspserver.vim +++ b/autoload/lsp/lspserver.vim @@ -1064,7 +1064,7 @@ def ShowReferences(lspserver: dict, 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 diff --git a/autoload/lsp/symbol.vim b/autoload/lsp/symbol.vim index 964d117..74fed32 100644 --- a/autoload/lsp/symbol.vim +++ b/autoload/lsp/symbol.vim @@ -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, locations: list>) +def PeekLocations(lspserver: dict, locations: list>, + 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, locations: list>) endfor var popupAttrs = { - title: 'References', + title: title, wrap: false, pos: 'topleft', line: 'cursor+1', @@ -348,10 +349,10 @@ def PeekLocations(lspserver: dict, locations: list>) UpdatePeekFilePopup(lspserver, locations) enddef -# Display or peek locations in a loclist -export def ShowLocations(lspserver: dict, locations: list>, peekSymbol: bool) +export def ShowLocations(lspserver: dict, locations: list>, + peekSymbol: bool, title: string) if peekSymbol - PeekLocations(lspserver, locations) + PeekLocations(lspserver, locations, title) return endif @@ -375,7 +376,7 @@ export def ShowLocations(lspserver: dict, locations: list>, 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 -- 2.48.1