@@ -31,8 +31,6 @@ import { SourceKitLSPErrorHandler } from "./LanguageClientManager";
31
31
/* eslint-disable @typescript-eslint/no-explicit-any */
32
32
function initializationOptions ( swiftVersion : Version ) : any {
33
33
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:`
36
34
"textDocument/codeLens" : {
37
35
supportedCommands : {
38
36
"swift.run" : "swift.run" ,
@@ -41,6 +39,25 @@ function initializationOptions(swiftVersion: Version): any {
41
39
} ,
42
40
} ;
43
41
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
+
44
61
// Swift 6.0.0 and later supports background indexing.
45
62
// In 6.0.0 it is experimental so only "true" enables it.
46
63
// 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 {
57
74
} ;
58
75
}
59
76
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 ) ) ) {
61
85
options = {
62
86
...options ,
63
87
"window/didChangeActiveDocument" : true , // the client can send `window/didChangeActiveDocument` notifications
0 commit comments