@@ -28,6 +28,7 @@ import { DiagnosticsManager } from "../DiagnosticsManager";
28
28
import { LSPLogger , LSPOutputChannel } from "./LSPOutputChannel" ;
29
29
import { SwiftOutputChannel } from "../ui/SwiftOutputChannel" ;
30
30
import { promptForDiagnostics } from "../commands/captureDiagnostics" ;
31
+ import { activateGetReferenceDocument } from "./getReferenceDocument" ;
31
32
32
33
interface SourceKitLogMessageParams extends langclient . LogMessageParams {
33
34
logName ?: string ;
@@ -110,6 +111,7 @@ export class LanguageClientManager {
110
111
private cancellationToken ?: vscode . CancellationTokenSource ;
111
112
private legacyInlayHints ?: vscode . Disposable ;
112
113
private peekDocuments ?: vscode . Disposable ;
114
+ private getReferenceDocument ?: vscode . Disposable ;
113
115
private restartedPromise ?: Promise < void > ;
114
116
private currentWorkspaceFolder ?: vscode . Uri ;
115
117
private waitingOnRestartCount : number ;
@@ -247,6 +249,7 @@ export class LanguageClientManager {
247
249
this . cancellationToken ?. dispose ( ) ;
248
250
this . legacyInlayHints ?. dispose ( ) ;
249
251
this . peekDocuments ?. dispose ( ) ;
252
+ this . getReferenceDocument ?. dispose ( ) ;
250
253
this . subscriptions . forEach ( item => item . dispose ( ) ) ;
251
254
this . languageClient ?. stop ( ) ;
252
255
this . namedOutputChannels . forEach ( channel => channel . dispose ( ) ) ;
@@ -397,6 +400,8 @@ export class LanguageClientManager {
397
400
this . legacyInlayHints = undefined ;
398
401
this . peekDocuments ?. dispose ( ) ;
399
402
this . peekDocuments = undefined ;
403
+ this . getReferenceDocument ?. dispose ( ) ;
404
+ this . getReferenceDocument = undefined ;
400
405
if ( client ) {
401
406
this . cancellationToken ?. cancel ( ) ;
402
407
this . cancellationToken ?. dispose ( ) ;
@@ -573,6 +578,7 @@ export class LanguageClientManager {
573
578
initializationFailedHandler : ( ) => false ,
574
579
initializationOptions : {
575
580
"workspace/peekDocuments" : true , // workaround for client capability to handle `PeekDocumentsRequest`
581
+ "workspace/getReferenceDocument" : true , // the client can handle URIs with scheme `sourcekit-lsp:`
576
582
"textDocument/codeLens" : {
577
583
supportedCommands : {
578
584
"swift.run" : "swift.run" ,
@@ -636,6 +642,8 @@ export class LanguageClientManager {
636
642
}
637
643
638
644
this . peekDocuments = activatePeekDocuments ( client ) ;
645
+ this . getReferenceDocument = activateGetReferenceDocument ( client ) ;
646
+ this . workspaceContext . subscriptions . push ( this . getReferenceDocument ) ;
639
647
} )
640
648
. catch ( reason => {
641
649
this . workspaceContext . outputChannel . log ( `${ reason } ` ) ;
0 commit comments