@@ -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 " ) ,
@@ -580,6 +578,7 @@ final class BackgroundIndexingTests: XCTestCase {
580
578
)
581
579
""" ,
582
580
serverOptions: serverOptions,
581
+ enableBackgroundIndexing: true ,
583
582
cleanUp: { expectedPreparationTracker. keepAlive ( ) }
584
583
)
585
584
@@ -637,7 +636,7 @@ final class BackgroundIndexingTests: XCTestCase {
637
636
let libDPreparedForEditing = self . expectation ( description: " LibD prepared for editing " )
638
637
639
638
try await SkipUnless . swiftpmStoresModulesInSubdirectory ( )
640
- var serverOptions = backgroundIndexingOptions
639
+ var serverOptions = SourceKitLSPServer . Options . testDefault
641
640
let expectedPreparationTracker = ExpectedIndexTaskTracker ( expectedPreparations: [
642
641
// Preparation of targets during the initial of the target
643
642
[
@@ -689,6 +688,7 @@ final class BackgroundIndexingTests: XCTestCase {
689
688
)
690
689
""" ,
691
690
serverOptions: serverOptions,
691
+ enableBackgroundIndexing: true ,
692
692
cleanUp: { expectedPreparationTracker. keepAlive ( ) }
693
693
)
694
694
@@ -718,7 +718,7 @@ final class BackgroundIndexingTests: XCTestCase {
718
718
files: [
719
719
" MyFile.swift " : " "
720
720
] ,
721
- serverOptions : backgroundIndexingOptions
721
+ enableBackgroundIndexing : true
722
722
)
723
723
let targetPrepareNotification = try await project. testClient. nextNotification ( ofType: LogMessageNotification . self)
724
724
XCTAssert (
@@ -732,13 +732,13 @@ final class BackgroundIndexingTests: XCTestCase {
732
732
)
733
733
}
734
734
735
- func testPreparationHappensInParallel ( ) async throws {
735
+ func testIndexingHappensInParallel ( ) async throws {
736
736
try await SkipUnless . swiftpmStoresModulesInSubdirectory ( )
737
737
738
738
let fileAIndexingStarted = self . expectation ( description: " FileA indexing started " )
739
739
let fileBIndexingStarted = self . expectation ( description: " FileB indexing started " )
740
740
741
- var serverOptions = backgroundIndexingOptions
741
+ var serverOptions = SourceKitLSPServer . Options . testDefault
742
742
let expectedIndexTaskTracker = ExpectedIndexTaskTracker (
743
743
expectedIndexStoreUpdates: [
744
744
[
@@ -771,6 +771,7 @@ final class BackgroundIndexingTests: XCTestCase {
771
771
" FileB.swift " : " " ,
772
772
] ,
773
773
serverOptions: serverOptions,
774
+ enableBackgroundIndexing: true ,
774
775
cleanUp: { expectedIndexTaskTracker. keepAlive ( ) }
775
776
)
776
777
}
@@ -801,10 +802,10 @@ final class BackgroundIndexingTests: XCTestCase {
801
802
]
802
803
)
803
804
""" ,
804
- serverOptions : backgroundIndexingOptions
805
+ enableBackgroundIndexing : true
805
806
)
806
807
807
- var otherClientOptions = backgroundIndexingOptions
808
+ var otherClientOptions = SourceKitLSPServer . Options . testDefault
808
809
otherClientOptions. indexTestHooks = IndexTestHooks (
809
810
preparationTaskDidStart: { taskDescription in
810
811
XCTFail ( " Did not expect any target preparation, got \( taskDescription. targetsToPrepare) " )
@@ -815,6 +816,7 @@ final class BackgroundIndexingTests: XCTestCase {
815
816
)
816
817
let otherClient = try await TestSourceKitLSPClient (
817
818
serverOptions: otherClientOptions,
819
+ enableBackgroundIndexing: true ,
818
820
workspaceFolders: [
819
821
WorkspaceFolder ( uri: DocumentURI ( project. scratchDirectory) )
820
822
]
0 commit comments