@@ -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 " ) ,
@@ -580,6 +578,7 @@ final class BackgroundIndexingTests: XCTestCase {
580578 )
581579 """ ,
582580 serverOptions: serverOptions,
581+ enableBackgroundIndexing: true ,
583582 cleanUp: { expectedPreparationTracker. keepAlive ( ) }
584583 )
585584
@@ -637,7 +636,7 @@ final class BackgroundIndexingTests: XCTestCase {
637636 let libDPreparedForEditing = self . expectation ( description: " LibD prepared for editing " )
638637
639638 try await SkipUnless . swiftpmStoresModulesInSubdirectory ( )
640- var serverOptions = backgroundIndexingOptions
639+ var serverOptions = SourceKitLSPServer . Options . testDefault
641640 let expectedPreparationTracker = ExpectedIndexTaskTracker ( expectedPreparations: [
642641 // Preparation of targets during the initial of the target
643642 [
@@ -689,6 +688,7 @@ final class BackgroundIndexingTests: XCTestCase {
689688 )
690689 """ ,
691690 serverOptions: serverOptions,
691+ enableBackgroundIndexing: true ,
692692 cleanUp: { expectedPreparationTracker. keepAlive ( ) }
693693 )
694694
@@ -718,7 +718,7 @@ final class BackgroundIndexingTests: XCTestCase {
718718 files: [
719719 " MyFile.swift " : " "
720720 ] ,
721- serverOptions : backgroundIndexingOptions
721+ enableBackgroundIndexing : true
722722 )
723723 let targetPrepareNotification = try await project. testClient. nextNotification ( ofType: LogMessageNotification . self)
724724 XCTAssert (
@@ -732,13 +732,13 @@ final class BackgroundIndexingTests: XCTestCase {
732732 )
733733 }
734734
735- func testPreparationHappensInParallel ( ) async throws {
735+ func testIndexingHappensInParallel ( ) async throws {
736736 try await SkipUnless . swiftpmStoresModulesInSubdirectory ( )
737737
738738 let fileAIndexingStarted = self . expectation ( description: " FileA indexing started " )
739739 let fileBIndexingStarted = self . expectation ( description: " FileB indexing started " )
740740
741- var serverOptions = backgroundIndexingOptions
741+ var serverOptions = SourceKitLSPServer . Options . testDefault
742742 let expectedIndexTaskTracker = ExpectedIndexTaskTracker (
743743 expectedIndexStoreUpdates: [
744744 [
@@ -771,6 +771,7 @@ final class BackgroundIndexingTests: XCTestCase {
771771 " FileB.swift " : " " ,
772772 ] ,
773773 serverOptions: serverOptions,
774+ enableBackgroundIndexing: true ,
774775 cleanUp: { expectedIndexTaskTracker. keepAlive ( ) }
775776 )
776777 }
@@ -801,10 +802,10 @@ final class BackgroundIndexingTests: XCTestCase {
801802 ]
802803 )
803804 """ ,
804- serverOptions : backgroundIndexingOptions
805+ enableBackgroundIndexing : true
805806 )
806807
807- var otherClientOptions = backgroundIndexingOptions
808+ var otherClientOptions = SourceKitLSPServer . Options . testDefault
808809 otherClientOptions. indexTestHooks = IndexTestHooks (
809810 preparationTaskDidStart: { taskDescription in
810811 XCTFail ( " Did not expect any target preparation, got \( taskDescription. targetsToPrepare) " )
@@ -815,6 +816,7 @@ final class BackgroundIndexingTests: XCTestCase {
815816 )
816817 let otherClient = try await TestSourceKitLSPClient (
817818 serverOptions: otherClientOptions,
819+ enableBackgroundIndexing: true ,
818820 workspaceFolders: [
819821 WorkspaceFolder ( uri: DocumentURI ( project. scratchDirectory) )
820822 ]
0 commit comments