Skip to content

Commit 30f1fd1

Browse files
committed
Remove warning message about missing compiler arguments
It turns out that this message was more noise than help. For example, it would often show up when adding a new file to a SwiftPM project: The file gets added before we reload the package and thus we don’t have build settings for the new file for a short while. Since we can’t dismiss the notification we sent to the client, the notification will stick around. Let’s just remove the message.
1 parent bce4cf6 commit 30f1fd1

File tree

2 files changed

+0
-15
lines changed

2 files changed

+0
-15
lines changed

Sources/SourceKitLSP/Swift/SwiftLanguageService.swift

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -430,20 +430,6 @@ extension SwiftLanguageService {
430430
}
431431

432432
let buildSettings = await self.buildSettings(for: snapshot.uri)
433-
if buildSettings == nil || buildSettings!.isFallback, let fileUrl = notification.textDocument.uri.fileURL {
434-
// Do not show this notification for non-file URIs to make sure we don't see this notificaiton for newly created
435-
// files (which get opened as with a `untitled:Unitled-1` URI by VS Code.
436-
sourceKitLSPServer?.sendNotificationToClient(
437-
ShowMessageNotification(
438-
type: .warning,
439-
message: """
440-
Failed to get compiler arguments for \(fileUrl.lastPathComponent).
441-
Ensure the source file is part of a Swift package or has compiler arguments in compile_commands.json.
442-
Functionality will be limited.
443-
"""
444-
)
445-
)
446-
}
447433

448434
let req = openDocumentSourcekitdRequest(snapshot: snapshot, compileCommand: buildSettings)
449435
_ = try? await self.sourcekitd.send(req, fileContents: snapshot.text)

Tests/SourceKitLSPTests/BuildSystemTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,6 @@ final class BuildSystemTests: XCTestCase {
287287
let documentManager = await self.testClient.server.documentManager
288288

289289
testClient.openDocument(text, uri: doc)
290-
_ = try await testClient.nextNotification(ofType: ShowMessageNotification.self)
291290
let openDiags = try await testClient.nextDiagnosticsNotification()
292291
XCTAssertEqual(openDiags.diagnostics.count, 1)
293292
XCTAssertEqual(text, try documentManager.latestSnapshot(doc).text)

0 commit comments

Comments
 (0)