@@ -1006,6 +1006,29 @@ def ShowReferences(lspserver: dict<any>, peek: bool): void
10061006 symbol.ShowLocations (lspserver, reply.result, peek, ' Symbol References' )
10071007enddef
10081008
1009+ # send custom locations request
1010+ def FindLocations (lspserver: dict <any> , peek: bool, method: string , args : dict <any> ): void
1011+ var param: dict <any>
1012+ param = lspserver.getTextDocPosition (true)- >extend (args )
1013+ var reply = lspserver.rpc (method, param)
1014+
1015+ # Result: Location[] | null
1016+ if reply- >empty () || reply.result- >empty ()
1017+ util.WarnMsg (' No references found' )
1018+ return
1019+ endif
1020+
1021+ if lspserver.needOffsetEncoding
1022+ # Decode the position encoding in all the reference locations
1023+ reply.result- >map ((_, loc ) = > {
1024+ lspserver.decodeLocation (loc )
1025+ return loc
1026+ })
1027+ endif
1028+
1029+ symbol.ShowLocations (lspserver, reply.result, peek, ' Symbol References' )
1030+ enddef
1031+
10091032# process the ' textDocument/documentHighlight' reply from the LSP server
10101033# Result: DocumentHighlight[] | null
10111034def DocHighlightReply (lspserver: dict <any> , docHighlightReply: any,
@@ -1948,6 +1971,7 @@ export def NewLspServer(serverParams: dict<any>): dict<any>
19481971 didSaveFile: function (DidSaveFile, [lspserver]),
19491972 hover: function (ShowHoverInfo, [lspserver]),
19501973 showReferences: function (ShowReferences, [lspserver]),
1974+ findLocations: function (FindLocations, [lspserver]),
19511975 docHighlight: function (DocHighlight, [lspserver]),
19521976 getDocSymbols: function (GetDocSymbols, [lspserver]),
19531977 textDocFormat: function (TextDocFormat, [lspserver]),
0 commit comments