@@ -20,6 +20,7 @@ import { isPathInsidePath, swiftRuntimeEnv } from "../utilities/utilities";
20
20
import { Version } from "../utilities/version" ;
21
21
import { FolderEvent , WorkspaceContext } from "../WorkspaceContext" ;
22
22
import { activateLegacyInlayHints } from "./inlayHints" ;
23
+ import { activatePeekDocuments } from "./peekDocuments" ;
23
24
import { FolderContext } from "../FolderContext" ;
24
25
import { LanguageClient } from "vscode-languageclient/node" ;
25
26
import { ArgumentFilter , BuildFlags } from "../toolchain/BuildFlags" ;
@@ -108,6 +109,7 @@ export class LanguageClientManager {
108
109
private languageClient : langclient . LanguageClient | null | undefined ;
109
110
private cancellationToken ?: vscode . CancellationTokenSource ;
110
111
private legacyInlayHints ?: vscode . Disposable ;
112
+ private peekDocuments ?: vscode . Disposable ;
111
113
private restartedPromise ?: Promise < void > ;
112
114
private currentWorkspaceFolder ?: vscode . Uri ;
113
115
private waitingOnRestartCount : number ;
@@ -244,6 +246,7 @@ export class LanguageClientManager {
244
246
this . cancellationToken ?. cancel ( ) ;
245
247
this . cancellationToken ?. dispose ( ) ;
246
248
this . legacyInlayHints ?. dispose ( ) ;
249
+ this . peekDocuments ?. dispose ( ) ;
247
250
this . subscriptions . forEach ( item => item . dispose ( ) ) ;
248
251
this . languageClient ?. stop ( ) ;
249
252
this . namedOutputChannels . forEach ( channel => channel . dispose ( ) ) ;
@@ -392,6 +395,8 @@ export class LanguageClientManager {
392
395
this . currentWorkspaceFolder = workspaceFolder ?. uri ;
393
396
this . legacyInlayHints ?. dispose ( ) ;
394
397
this . legacyInlayHints = undefined ;
398
+ this . peekDocuments ?. dispose ( ) ;
399
+ this . peekDocuments = undefined ;
395
400
if ( client ) {
396
401
this . cancellationToken ?. cancel ( ) ;
397
402
this . cancellationToken ?. dispose ( ) ;
@@ -559,6 +564,9 @@ export class LanguageClientManager {
559
564
} ) ( ) ,
560
565
} ,
561
566
errorHandler : new SourceKitLSPErrorHandler ( 5 ) ,
567
+ initializationOptions : {
568
+ "workspace/peekDocuments" : true , // workaround for client capability to handle `PeekDocumentsRequest`
569
+ } ,
562
570
} ;
563
571
564
572
return new langclient . LanguageClient (
@@ -604,6 +612,8 @@ export class LanguageClientManager {
604
612
if ( this . workspaceContext . swiftVersion . isLessThan ( new Version ( 5 , 7 , 0 ) ) ) {
605
613
this . legacyInlayHints = activateLegacyInlayHints ( client ) ;
606
614
}
615
+
616
+ this . peekDocuments = activatePeekDocuments ( client ) ;
607
617
} )
608
618
. catch ( reason => {
609
619
this . workspaceContext . outputChannel . log ( `${ reason } ` ) ;
0 commit comments