@@ -18,10 +18,6 @@ import SemanticIndex
1818import SourceKitLSP
1919import XCTest
2020
21- fileprivate let backgroundIndexingOptions = SourceKitLSPServer . Options (
22- indexOptions: IndexOptions ( enableBackgroundIndexing: true )
23- )
24-
2521final class BackgroundIndexingTests : XCTestCase {
2622 func testBackgroundIndexingOfSingleFile( ) async throws {
2723 let project = try await SwiftPMTestProject (
@@ -33,7 +29,7 @@ final class BackgroundIndexingTests: XCTestCase {
3329 }
3430 """
3531 ] ,
36- serverOptions : backgroundIndexingOptions
32+ enableBackgroundIndexing : true
3733 )
3834
3935 let ( uri, positions) = try project. openDocument ( " MyFile.swift " )
@@ -76,7 +72,7 @@ final class BackgroundIndexingTests: XCTestCase {
7672 }
7773 """ ,
7874 ] ,
79- serverOptions : backgroundIndexingOptions
75+ enableBackgroundIndexing : true
8076 )
8177
8278 let ( uri, positions) = try project. openDocument ( " MyFile.swift " )
@@ -134,7 +130,7 @@ final class BackgroundIndexingTests: XCTestCase {
134130 ]
135131 )
136132 """ ,
137- serverOptions : backgroundIndexingOptions
133+ enableBackgroundIndexing : true
138134 )
139135
140136 let ( uri, positions) = try project. openDocument ( " MyFile.swift " )
@@ -166,7 +162,7 @@ final class BackgroundIndexingTests: XCTestCase {
166162 }
167163
168164 func testBackgroundIndexingHappensWithLowPriority( ) async throws {
169- var serverOptions = backgroundIndexingOptions
165+ var serverOptions = SourceKitLSPServer . Options . testDefault
170166 serverOptions. indexTestHooks. preparationTaskDidFinish = { taskDescription in
171167 XCTAssert ( Task . currentPriority == . low, " \( taskDescription) ran with priority \( Task . currentPriority) " )
172168 }
@@ -199,6 +195,7 @@ final class BackgroundIndexingTests: XCTestCase {
199195 )
200196 """ ,
201197 serverOptions: serverOptions,
198+ enableBackgroundIndexing: true ,
202199 pollIndex: false
203200 )
204201
@@ -249,7 +246,7 @@ final class BackgroundIndexingTests: XCTestCase {
249246 ]
250247 )
251248 """ ,
252- serverOptions : backgroundIndexingOptions
249+ enableBackgroundIndexing : true
253250 )
254251
255252 let dependencyUrl = try XCTUnwrap (
@@ -300,7 +297,7 @@ final class BackgroundIndexingTests: XCTestCase {
300297 }
301298 """ ,
302299 ] ,
303- serverOptions : backgroundIndexingOptions
300+ enableBackgroundIndexing : true
304301 )
305302
306303 let ( uri, positions) = try project. openDocument ( " MyFile.c " )
@@ -339,7 +336,7 @@ final class BackgroundIndexingTests: XCTestCase {
339336 let receivedReportProgressNotification = self . expectation (
340337 description: " Received work done progress saying indexing "
341338 )
342- var serverOptions = backgroundIndexingOptions
339+ var serverOptions = SourceKitLSPServer . Options . testDefault
343340 serverOptions. indexTestHooks = IndexTestHooks (
344341 buildGraphGenerationDidFinish: {
345342 await self . fulfillment ( of: [ receivedBeginProgressNotification] , timeout: defaultTimeout)
@@ -359,6 +356,7 @@ final class BackgroundIndexingTests: XCTestCase {
359356 ] ,
360357 capabilities: ClientCapabilities ( window: WindowClientCapabilities ( workDoneProgress: true ) ) ,
361358 serverOptions: serverOptions,
359+ enableBackgroundIndexing: true ,
362360 pollIndex: false ,
363361 preInitialization: { testClient in
364362 testClient. handleMultipleRequests { ( request: CreateWorkDoneProgressRequest ) in
@@ -419,7 +417,7 @@ final class BackgroundIndexingTests: XCTestCase {
419417 """ ,
420418 " MyOtherFile.swift " : " " ,
421419 ] ,
422- serverOptions : backgroundIndexingOptions
420+ enableBackgroundIndexing : true
423421 )
424422
425423 let ( uri, positions) = try project. openDocument ( " MyFile.swift " )
@@ -486,7 +484,7 @@ final class BackgroundIndexingTests: XCTestCase {
486484 #include " Header.h "
487485 """ ,
488486 ] ,
489- serverOptions : backgroundIndexingOptions
487+ enableBackgroundIndexing : true
490488 )
491489
492490 let ( uri, positions) = try project. openDocument ( " Header.h " , language: . c)
@@ -544,7 +542,7 @@ final class BackgroundIndexingTests: XCTestCase {
544542
545543 func testPrepareTargetAfterEditToDependency( ) async throws {
546544 try await SkipUnless . swiftpmStoresModulesInSubdirectory ( )
547- var serverOptions = backgroundIndexingOptions
545+ var serverOptions = SourceKitLSPServer . Options . testDefault
548546 let expectedPreparationTracker = ExpectedIndexTaskTracker ( expectedPreparations: [
549547 [
550548 ExpectedPreparation ( targetID: " LibA " , runDestinationID: " dummy " ) ,
@@ -581,6 +579,7 @@ final class BackgroundIndexingTests: XCTestCase {
581579 """ ,
582580 capabilities: ClientCapabilities ( window: WindowClientCapabilities ( workDoneProgress: true ) ) ,
583581 serverOptions: serverOptions,
582+ enableBackgroundIndexing: true ,
584583 cleanUp: { expectedPreparationTracker. keepAlive ( ) }
585584 )
586585
@@ -653,7 +652,7 @@ final class BackgroundIndexingTests: XCTestCase {
653652 let libDPreparedForEditing = self . expectation ( description: " LibD prepared for editing " )
654653
655654 try await SkipUnless . swiftpmStoresModulesInSubdirectory ( )
656- var serverOptions = backgroundIndexingOptions
655+ var serverOptions = SourceKitLSPServer . Options . testDefault
657656 let expectedPreparationTracker = ExpectedIndexTaskTracker ( expectedPreparations: [
658657 // Preparation of targets during the initial of the target
659658 [
@@ -705,6 +704,7 @@ final class BackgroundIndexingTests: XCTestCase {
705704 )
706705 """ ,
707706 serverOptions: serverOptions,
707+ enableBackgroundIndexing: true ,
708708 cleanUp: { expectedPreparationTracker. keepAlive ( ) }
709709 )
710710
@@ -734,7 +734,7 @@ final class BackgroundIndexingTests: XCTestCase {
734734 files: [
735735 " MyFile.swift " : " "
736736 ] ,
737- serverOptions : backgroundIndexingOptions
737+ enableBackgroundIndexing : true
738738 )
739739 let targetPrepareNotification = try await project. testClient. nextNotification ( ofType: LogMessageNotification . self)
740740 XCTAssert (
@@ -748,13 +748,13 @@ final class BackgroundIndexingTests: XCTestCase {
748748 )
749749 }
750750
751- func testPreparationHappensInParallel ( ) async throws {
751+ func testIndexingHappensInParallel ( ) async throws {
752752 try await SkipUnless . swiftpmStoresModulesInSubdirectory ( )
753753
754754 let fileAIndexingStarted = self . expectation ( description: " FileA indexing started " )
755755 let fileBIndexingStarted = self . expectation ( description: " FileB indexing started " )
756756
757- var serverOptions = backgroundIndexingOptions
757+ var serverOptions = SourceKitLSPServer . Options . testDefault
758758 let expectedIndexTaskTracker = ExpectedIndexTaskTracker (
759759 expectedIndexStoreUpdates: [
760760 [
@@ -787,6 +787,7 @@ final class BackgroundIndexingTests: XCTestCase {
787787 " FileB.swift " : " " ,
788788 ] ,
789789 serverOptions: serverOptions,
790+ enableBackgroundIndexing: true ,
790791 cleanUp: { expectedIndexTaskTracker. keepAlive ( ) }
791792 )
792793 }
@@ -817,10 +818,10 @@ final class BackgroundIndexingTests: XCTestCase {
817818 ]
818819 )
819820 """ ,
820- serverOptions : backgroundIndexingOptions
821+ enableBackgroundIndexing : true
821822 )
822823
823- var otherClientOptions = backgroundIndexingOptions
824+ var otherClientOptions = SourceKitLSPServer . Options . testDefault
824825 otherClientOptions. indexTestHooks = IndexTestHooks (
825826 preparationTaskDidStart: { taskDescription in
826827 XCTFail ( " Did not expect any target preparation, got \( taskDescription. targetsToPrepare) " )
@@ -831,6 +832,7 @@ final class BackgroundIndexingTests: XCTestCase {
831832 )
832833 let otherClient = try await TestSourceKitLSPClient (
833834 serverOptions: otherClientOptions,
835+ enableBackgroundIndexing: true ,
834836 workspaceFolders: [
835837 WorkspaceFolder ( uri: DocumentURI ( project. scratchDirectory) )
836838 ]
0 commit comments