@@ -27,7 +27,7 @@ import { DiagnosticsManager } from "../DiagnosticsManager";
27
27
import { LSPLogger , LSPOutputChannel } from "./LSPOutputChannel" ;
28
28
import { SwiftOutputChannel } from "../ui/SwiftOutputChannel" ;
29
29
import { promptForDiagnostics } from "../commands/captureDiagnostics" ;
30
- import { PeekMacroParams , PeekMacroRequest } from "./lspExtensions" ;
30
+ import { PeekDocumentsParams , PeekDocumentsRequest } from "./lspExtensions" ;
31
31
32
32
interface SourceKitLogMessageParams extends langclient . LogMessageParams {
33
33
logName ?: string ;
@@ -620,36 +620,32 @@ export class LanguageClientManager {
620
620
this . languageClient = client ;
621
621
this . cancellationToken = new vscode . CancellationTokenSource ( ) ;
622
622
623
- this . languageClient . onRequest ( PeekMacroRequest . method , async ( params : PeekMacroParams ) => {
624
- const locations = params . macroExpansion . expansionURIs . map ( uri => {
625
- const location = new vscode . Location (
626
- vscode . Uri . from ( {
627
- scheme : "file" ,
628
- path : new URL ( uri ) . pathname ,
629
- } ) ,
630
- new vscode . Position ( 0 , 0 )
631
- ) ;
632
-
633
- return location ;
634
- } ) ;
635
-
636
- console . log ( params . peekLocation ) ;
623
+ this . languageClient . onRequest (
624
+ PeekDocumentsRequest . method ,
625
+ async ( params : PeekDocumentsParams ) => {
626
+ const locations = params . locations . map ( uri => {
627
+ const location = new vscode . Location (
628
+ vscode . Uri . from ( {
629
+ scheme : "file" ,
630
+ path : new URL ( uri ) . pathname ,
631
+ } ) ,
632
+ new vscode . Position ( 0 , 0 )
633
+ ) ;
637
634
638
- const peekPosition = new vscode . Position (
639
- params . peekLocation . line ,
640
- params . peekLocation . character
641
- ) ;
635
+ return location ;
636
+ } ) ;
642
637
643
- await vscode . commands . executeCommand (
644
- "editor.action.peekLocations" ,
645
- vscode . window . activeTextEditor ?. document . uri ,
646
- peekPosition ,
647
- locations ,
648
- "peek"
649
- ) ;
638
+ await vscode . commands . executeCommand (
639
+ "editor.action.peekLocations" ,
640
+ params . uri ?? vscode . window . activeTextEditor ?. document . uri ,
641
+ params . position ?? vscode . window . activeTextEditor ?. selection . active ,
642
+ locations ,
643
+ params . multiple
644
+ ) ;
650
645
651
- return { success : true } ;
652
- } ) ;
646
+ return { success : true } ;
647
+ }
648
+ ) ;
653
649
654
650
return this . clientReadyPromise ;
655
651
}
0 commit comments