@@ -18,10 +18,6 @@ import SemanticIndex
18
18
import SourceKitLSP
19
19
import XCTest
20
20
21
- fileprivate let backgroundIndexingOptions = SourceKitLSPServer . Options (
22
- indexOptions: IndexOptions ( enableBackgroundIndexing: true )
23
- )
24
-
25
21
final class BackgroundIndexingTests : XCTestCase {
26
22
func testBackgroundIndexingOfSingleFile( ) async throws {
27
23
let project = try await SwiftPMTestProject (
@@ -33,7 +29,7 @@ final class BackgroundIndexingTests: XCTestCase {
33
29
}
34
30
"""
35
31
] ,
36
- serverOptions : backgroundIndexingOptions
32
+ enableBackgroundIndexing : true
37
33
)
38
34
39
35
let ( uri, positions) = try project. openDocument ( " MyFile.swift " )
@@ -76,7 +72,7 @@ final class BackgroundIndexingTests: XCTestCase {
76
72
}
77
73
""" ,
78
74
] ,
79
- serverOptions : backgroundIndexingOptions
75
+ enableBackgroundIndexing : true
80
76
)
81
77
82
78
let ( uri, positions) = try project. openDocument ( " MyFile.swift " )
@@ -134,7 +130,7 @@ final class BackgroundIndexingTests: XCTestCase {
134
130
]
135
131
)
136
132
""" ,
137
- serverOptions : backgroundIndexingOptions
133
+ enableBackgroundIndexing : true
138
134
)
139
135
140
136
let ( uri, positions) = try project. openDocument ( " MyFile.swift " )
@@ -166,7 +162,7 @@ final class BackgroundIndexingTests: XCTestCase {
166
162
}
167
163
168
164
func testBackgroundIndexingHappensWithLowPriority( ) async throws {
169
- var serverOptions = backgroundIndexingOptions
165
+ var serverOptions = SourceKitLSPServer . Options . testDefault
170
166
serverOptions. indexTestHooks. preparationTaskDidFinish = { taskDescription in
171
167
XCTAssert ( Task . currentPriority == . low, " \( taskDescription) ran with priority \( Task . currentPriority) " )
172
168
}
@@ -199,6 +195,7 @@ final class BackgroundIndexingTests: XCTestCase {
199
195
)
200
196
""" ,
201
197
serverOptions: serverOptions,
198
+ enableBackgroundIndexing: true ,
202
199
pollIndex: false
203
200
)
204
201
@@ -249,7 +246,7 @@ final class BackgroundIndexingTests: XCTestCase {
249
246
]
250
247
)
251
248
""" ,
252
- serverOptions : backgroundIndexingOptions
249
+ enableBackgroundIndexing : true
253
250
)
254
251
255
252
let dependencyUrl = try XCTUnwrap (
@@ -300,7 +297,7 @@ final class BackgroundIndexingTests: XCTestCase {
300
297
}
301
298
""" ,
302
299
] ,
303
- serverOptions : backgroundIndexingOptions
300
+ enableBackgroundIndexing : true
304
301
)
305
302
306
303
let ( uri, positions) = try project. openDocument ( " MyFile.c " )
@@ -339,7 +336,7 @@ final class BackgroundIndexingTests: XCTestCase {
339
336
let receivedReportProgressNotification = self . expectation (
340
337
description: " Received work done progress saying indexing "
341
338
)
342
- var serverOptions = backgroundIndexingOptions
339
+ var serverOptions = SourceKitLSPServer . Options . testDefault
343
340
serverOptions. indexTestHooks = IndexTestHooks (
344
341
buildGraphGenerationDidFinish: {
345
342
await self . fulfillment ( of: [ receivedBeginProgressNotification] , timeout: defaultTimeout)
@@ -359,6 +356,7 @@ final class BackgroundIndexingTests: XCTestCase {
359
356
] ,
360
357
capabilities: ClientCapabilities ( window: WindowClientCapabilities ( workDoneProgress: true ) ) ,
361
358
serverOptions: serverOptions,
359
+ enableBackgroundIndexing: true ,
362
360
pollIndex: false ,
363
361
preInitialization: { testClient in
364
362
testClient. handleMultipleRequests { ( request: CreateWorkDoneProgressRequest ) in
@@ -419,7 +417,7 @@ final class BackgroundIndexingTests: XCTestCase {
419
417
""" ,
420
418
" MyOtherFile.swift " : " " ,
421
419
] ,
422
- serverOptions : backgroundIndexingOptions
420
+ enableBackgroundIndexing : true
423
421
)
424
422
425
423
let ( uri, positions) = try project. openDocument ( " MyFile.swift " )
@@ -486,7 +484,7 @@ final class BackgroundIndexingTests: XCTestCase {
486
484
#include " Header.h "
487
485
""" ,
488
486
] ,
489
- serverOptions : backgroundIndexingOptions
487
+ enableBackgroundIndexing : true
490
488
)
491
489
492
490
let ( uri, positions) = try project. openDocument ( " Header.h " , language: . c)
@@ -544,7 +542,7 @@ final class BackgroundIndexingTests: XCTestCase {
544
542
545
543
func testPrepareTargetAfterEditToDependency( ) async throws {
546
544
try await SkipUnless . swiftpmStoresModulesInSubdirectory ( )
547
- var serverOptions = backgroundIndexingOptions
545
+ var serverOptions = SourceKitLSPServer . Options . testDefault
548
546
let expectedPreparationTracker = ExpectedIndexTaskTracker ( expectedPreparations: [
549
547
[
550
548
ExpectedPreparation ( targetID: " LibA " , runDestinationID: " dummy " ) ,
@@ -581,6 +579,7 @@ final class BackgroundIndexingTests: XCTestCase {
581
579
""" ,
582
580
capabilities: ClientCapabilities ( window: WindowClientCapabilities ( workDoneProgress: true ) ) ,
583
581
serverOptions: serverOptions,
582
+ enableBackgroundIndexing: true ,
584
583
cleanUp: { expectedPreparationTracker. keepAlive ( ) }
585
584
)
586
585
@@ -653,7 +652,7 @@ final class BackgroundIndexingTests: XCTestCase {
653
652
let libDPreparedForEditing = self . expectation ( description: " LibD prepared for editing " )
654
653
655
654
try await SkipUnless . swiftpmStoresModulesInSubdirectory ( )
656
- var serverOptions = backgroundIndexingOptions
655
+ var serverOptions = SourceKitLSPServer . Options . testDefault
657
656
let expectedPreparationTracker = ExpectedIndexTaskTracker ( expectedPreparations: [
658
657
// Preparation of targets during the initial of the target
659
658
[
@@ -705,6 +704,7 @@ final class BackgroundIndexingTests: XCTestCase {
705
704
)
706
705
""" ,
707
706
serverOptions: serverOptions,
707
+ enableBackgroundIndexing: true ,
708
708
cleanUp: { expectedPreparationTracker. keepAlive ( ) }
709
709
)
710
710
@@ -734,7 +734,7 @@ final class BackgroundIndexingTests: XCTestCase {
734
734
files: [
735
735
" MyFile.swift " : " "
736
736
] ,
737
- serverOptions : backgroundIndexingOptions
737
+ enableBackgroundIndexing : true
738
738
)
739
739
let targetPrepareNotification = try await project. testClient. nextNotification ( ofType: LogMessageNotification . self)
740
740
XCTAssert (
@@ -748,13 +748,13 @@ final class BackgroundIndexingTests: XCTestCase {
748
748
)
749
749
}
750
750
751
- func testPreparationHappensInParallel ( ) async throws {
751
+ func testIndexingHappensInParallel ( ) async throws {
752
752
try await SkipUnless . swiftpmStoresModulesInSubdirectory ( )
753
753
754
754
let fileAIndexingStarted = self . expectation ( description: " FileA indexing started " )
755
755
let fileBIndexingStarted = self . expectation ( description: " FileB indexing started " )
756
756
757
- var serverOptions = backgroundIndexingOptions
757
+ var serverOptions = SourceKitLSPServer . Options . testDefault
758
758
let expectedIndexTaskTracker = ExpectedIndexTaskTracker (
759
759
expectedIndexStoreUpdates: [
760
760
[
@@ -787,6 +787,7 @@ final class BackgroundIndexingTests: XCTestCase {
787
787
" FileB.swift " : " " ,
788
788
] ,
789
789
serverOptions: serverOptions,
790
+ enableBackgroundIndexing: true ,
790
791
cleanUp: { expectedIndexTaskTracker. keepAlive ( ) }
791
792
)
792
793
}
@@ -817,10 +818,10 @@ final class BackgroundIndexingTests: XCTestCase {
817
818
]
818
819
)
819
820
""" ,
820
- serverOptions : backgroundIndexingOptions
821
+ enableBackgroundIndexing : true
821
822
)
822
823
823
- var otherClientOptions = backgroundIndexingOptions
824
+ var otherClientOptions = SourceKitLSPServer . Options . testDefault
824
825
otherClientOptions. indexTestHooks = IndexTestHooks (
825
826
preparationTaskDidStart: { taskDescription in
826
827
XCTFail ( " Did not expect any target preparation, got \( taskDescription. targetsToPrepare) " )
@@ -831,6 +832,7 @@ final class BackgroundIndexingTests: XCTestCase {
831
832
)
832
833
let otherClient = try await TestSourceKitLSPClient (
833
834
serverOptions: otherClientOptions,
835
+ enableBackgroundIndexing: true ,
834
836
workspaceFolders: [
835
837
WorkspaceFolder ( uri: DocumentURI ( project. scratchDirectory) )
836
838
]
0 commit comments