@@ -32,8 +32,6 @@ import { SourceKitLSPErrorHandler } from "./LanguageClientManager";
32
32
/* eslint-disable @typescript-eslint/no-explicit-any */
33
33
function initializationOptions ( swiftVersion : Version ) : any {
34
34
let options : any = {
35
- "workspace/peekDocuments" : true , // workaround for client capability to handle `PeekDocumentsRequest`
36
- "workspace/getReferenceDocument" : true , // the client can handle URIs with scheme `sourcekit-lsp:`
37
35
"textDocument/codeLens" : {
38
36
supportedCommands : {
39
37
"swift.run" : "swift.run" ,
@@ -42,6 +40,25 @@ function initializationOptions(swiftVersion: Version): any {
42
40
} ,
43
41
} ;
44
42
43
+ // Swift 6.3 changed the value to enable experimental client capabilities from `true` to `{ "supported": true }`
44
+ // (https://github.com/swiftlang/sourcekit-lsp/pull/2204)
45
+ if ( swiftVersion . isGreaterThanOrEqual ( new Version ( 6 , 3 , 0 ) ) ) {
46
+ options = {
47
+ "workspace/peekDocuments" : {
48
+ supported : true , // workaround for client capability to handle `PeekDocumentsRequest`
49
+ } ,
50
+ "workspace/getReferenceDocument" : {
51
+ supported : true , // the client can handle URIs with scheme `sourcekit-lsp:`
52
+ } ,
53
+ } ;
54
+ } else {
55
+ options = {
56
+ ...options ,
57
+ "workspace/peekDocuments" : true , // workaround for client capability to handle `PeekDocumentsRequest`
58
+ "workspace/getReferenceDocument" : true , // the client can handle URIs with scheme `sourcekit-lsp:`
59
+ } ;
60
+ }
61
+
45
62
// Swift 6.0.0 and later supports background indexing.
46
63
// In 6.0.0 it is experimental so only "true" enables it.
47
64
// In 6.1.0 it is no longer experimental, and so "auto" or "true" enables it.
@@ -58,7 +75,14 @@ function initializationOptions(swiftVersion: Version): any {
58
75
} ;
59
76
}
60
77
61
- if ( swiftVersion . isGreaterThanOrEqual ( new Version ( 6 , 1 , 0 ) ) ) {
78
+ if ( swiftVersion . isGreaterThanOrEqual ( new Version ( 6 , 3 , 0 ) ) ) {
79
+ options = {
80
+ ...options ,
81
+ "window/didChangeActiveDocument" : {
82
+ supported : true , // the client can send `window/didChangeActiveDocument` notifications
83
+ } ,
84
+ } ;
85
+ } else if ( swiftVersion . isGreaterThanOrEqual ( new Version ( 6 , 1 , 0 ) ) ) {
62
86
options = {
63
87
...options ,
64
88
"window/didChangeActiveDocument" : true , // the client can send `window/didChangeActiveDocument` notifications
0 commit comments