@@ -31,8 +31,6 @@ import { SourceKitLSPErrorHandler } from "./LanguageClientManager";
3131/* eslint-disable @typescript-eslint/no-explicit-any */
3232function initializationOptions ( swiftVersion : Version ) : any {
3333 let options : any = {
34- "workspace/peekDocuments" : true , // workaround for client capability to handle `PeekDocumentsRequest`
35- "workspace/getReferenceDocument" : true , // the client can handle URIs with scheme `sourcekit-lsp:`
3634 "textDocument/codeLens" : {
3735 supportedCommands : {
3836 "swift.run" : "swift.run" ,
@@ -41,6 +39,25 @@ function initializationOptions(swiftVersion: Version): any {
4139 } ,
4240 } ;
4341
42+ // Swift 6.3 changed the value to enable experimental client capabilities from `true` to `{ "supported": true }`
43+ // (https://github.com/swiftlang/sourcekit-lsp/pull/2204)
44+ if ( swiftVersion . isGreaterThanOrEqual ( new Version ( 6 , 3 , 0 ) ) ) {
45+ options = {
46+ "workspace/peekDocuments" : {
47+ supported : true , // workaround for client capability to handle `PeekDocumentsRequest`
48+ } ,
49+ "workspace/getReferenceDocument" : {
50+ supported : true , // the client can handle URIs with scheme `sourcekit-lsp:`
51+ } ,
52+ } ;
53+ } else {
54+ options = {
55+ ...options ,
56+ "workspace/peekDocuments" : true , // workaround for client capability to handle `PeekDocumentsRequest`
57+ "workspace/getReferenceDocument" : true , // the client can handle URIs with scheme `sourcekit-lsp:`
58+ } ;
59+ }
60+
4461 // Swift 6.0.0 and later supports background indexing.
4562 // In 6.0.0 it is experimental so only "true" enables it.
4663 // In 6.1.0 it is no longer experimental, and so "auto" or "true" enables it.
@@ -57,7 +74,14 @@ function initializationOptions(swiftVersion: Version): any {
5774 } ;
5875 }
5976
60- if ( swiftVersion . isGreaterThanOrEqual ( new Version ( 6 , 1 , 0 ) ) ) {
77+ if ( swiftVersion . isGreaterThanOrEqual ( new Version ( 6 , 3 , 0 ) ) ) {
78+ options = {
79+ ...options ,
80+ "window/didChangeActiveDocument" : {
81+ supported : true , // the client can send `window/didChangeActiveDocument` notifications
82+ } ,
83+ } ;
84+ } else if ( swiftVersion . isGreaterThanOrEqual ( new Version ( 6 , 1 , 0 ) ) ) {
6185 options = {
6286 ...options ,
6387 "window/didChangeActiveDocument" : true , // the client can send `window/didChangeActiveDocument` notifications
0 commit comments