Skip to content

Commit cbd897d

Browse files
committed
Don’t show warning message when opening projects that don't support background indexing
Since we enabled background indexing by default, the user is no longer explicitly opting into it. A user might be exclusively working with compilation database projects or BSP server without background indexing support and thus not care that we switched the background indexing default. We shouldn’t bother them with a warning message every time they launch sourcekit-lsp.
1 parent 9bbb8f3 commit cbd897d

File tree

2 files changed

+0
-31
lines changed

2 files changed

+0
-31
lines changed

Sources/SourceKitLSP/SourceKitLSPServer.swift

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,6 @@ package actor SourceKitLSPServer {
8484
/// Initialization can be awaited using `waitUntilInitialized`.
8585
private var initialized: Bool = false
8686

87-
/// Set to `true` after the user has opened a project that doesn't support background indexing while having background
88-
/// indexing enabled.
89-
///
90-
/// This ensures that we only inform the user about background indexing not being supported for these projects once.
91-
private var didSendBackgroundIndexingNotSupportedNotification = false
92-
9387
var options: SourceKitLSPOptions
9488

9589
let testHooks: TestHooks
@@ -841,20 +835,6 @@ extension SourceKitLSPServer {
841835
testHooks: testHooks,
842836
indexTaskScheduler: indexTaskScheduler
843837
)
844-
if options.backgroundIndexingOrDefault, workspace.semanticIndexManager == nil,
845-
!self.didSendBackgroundIndexingNotSupportedNotification
846-
{
847-
self.sendNotificationToClient(
848-
ShowMessageNotification(
849-
type: .info,
850-
message: """
851-
Background indexing is currently only supported for SwiftPM projects. \
852-
For all other project types, please run a build to update the index.
853-
"""
854-
)
855-
)
856-
self.didSendBackgroundIndexingNotSupportedNotification = true
857-
}
858838
return workspace
859839
}
860840

Tests/SourceKitLSPTests/BackgroundIndexingTests.swift

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -885,17 +885,6 @@ final class BackgroundIndexingTests: XCTestCase {
885885
)
886886
}
887887

888-
func testShowMessageWhenOpeningAProjectThatDoesntSupportBackgroundIndexing() async throws {
889-
let project = try await MultiFileTestProject(
890-
files: [
891-
"compile_commands.json": ""
892-
],
893-
enableBackgroundIndexing: true
894-
)
895-
let message = try await project.testClient.nextNotification(ofType: ShowMessageNotification.self)
896-
XCTAssert(message.message.contains("Background indexing"), "Received unexpected message: \(message.message)")
897-
}
898-
899888
func testNoPreparationStatusIfTargetIsUpToDate() async throws {
900889
let project = try await SwiftPMTestProject(
901890
files: [

0 commit comments

Comments
 (0)